diff --git a/bin/Phone.py b/bin/Phone.py index b25dae41..e18e12c0 100755 --- a/bin/Phone.py +++ b/bin/Phone.py @@ -6,6 +6,7 @@ import time import re +import phonenumbers from packages import Paste from pubsublogger import publisher from Helper import Process @@ -27,6 +28,20 @@ def search_phone(message): p.populate_set_out('phone;{}'.format(message), 'BrowseWarningPaste') #Send to duplicate p.populate_set_out(message, 'Duplicate') + stats = {} + for phone_number in results: + try: + x = phonenumbers.parse(phone_number, None) + country_code = x.country_code + if stats.get(country_code) is None: + stats[country_code] = 1 + else: + stats[country_code] = stats[country_code] + 1 + except: + pass + for country_code in stats: + if stats[country_code] > 4: + publisher.warning('{} contains Phone numbers with country code {}'.format(paste.p_name, country_code)) if __name__ == '__main__': # If you wish to use an other port of channel, do not forget to run a subscriber accordingly (see launch_logs.sh) diff --git a/doc/screenshots/sentiment.png b/doc/screenshots/sentiment.png new file mode 100644 index 00000000..1aa0fc05 Binary files /dev/null and b/doc/screenshots/sentiment.png differ diff --git a/pip_packages_requirement.txt b/pip_packages_requirement.txt index ab5aa42c..8bffb7b5 100644 --- a/pip_packages_requirement.txt +++ b/pip_packages_requirement.txt @@ -26,6 +26,7 @@ ssdeep python-magic pybloomfiltermmap psutil +phonenumbers ipython flask