From c53d514cfc3a3445e690eec0c33c052b8750c5c1 Mon Sep 17 00:00:00 2001 From: sundowndev Date: Tue, 11 Dec 2018 14:35:26 +0100 Subject: [PATCH 1/2] [Fix #4] Update OSINT files --- phoneinfoga.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/phoneinfoga.py b/phoneinfoga.py index 7e1de92..0980452 100644 --- a/phoneinfoga.py +++ b/phoneinfoga.py @@ -44,7 +44,7 @@ parser.add_argument('--osint', action='store_true', help='Use OSINT reconnaissance') parser.add_argument('-u', '--update', action='store_true', - help='Update the tool & databases') + help='Update the project') args = parser.parse_args() @@ -53,10 +53,6 @@ if not len(sys.argv) > 1: parser.print_help() sys.exit() -if args.update: - print('update') - sys.exit() - try: import time import hashlib @@ -76,6 +72,35 @@ except: print('\033[91m[!] Missing requirements. Try running pip install -r requirements.txt') sys.exit() +if args.update: + def download_file(url, target_path): + response = requests.get(url, stream=True) + handle = open(target_path, "wb") + for chunk in response.iter_content(chunk_size=512): + if chunk: # filter out keep-alive new chunks + handle.write(chunk) + + print('Updating PhoneInfoga.') + print('Actual version: {}'.format(__version__)) + + # Fetching last github tag + new_version = json.loads(requests.get('https://api.github.com/repos/sundowndev/PhoneInfoga/tags').content)[0]['name'] + print('Last version: {}'.format(new_version)) + + osintFiles = ['disposable_num_providers.json', 'individuals.json', 'reputation.json', 'social_medias.json'] + + try: + for file in osintFiles: + url = 'https://raw.githubusercontent.com/sundowndev/PhoneInfoga/master/osint/{}'.format(file) + output_directory = 'osint/{}'.format(file) + download_file(url, output_directory) + except: + print('Update failed. Try using git pull.') + sys.exit() + + print('The tool was successfully updated.') + sys.exit() + scanners = ['any', 'all', 'numverify', 'ovh'] uagent = [] From 92d1683a86c358cd954f149ab2f3ef255f2caade Mon Sep 17 00:00:00 2001 From: sundowndev Date: Tue, 11 Dec 2018 14:57:01 +0100 Subject: [PATCH 2/2] Python script update feature --- phoneinfoga.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phoneinfoga.py b/phoneinfoga.py index 0980452..707cbbc 100644 --- a/phoneinfoga.py +++ b/phoneinfoga.py @@ -80,7 +80,7 @@ if args.update: if chunk: # filter out keep-alive new chunks handle.write(chunk) - print('Updating PhoneInfoga.') + print('Updating PhoneInfoga...') print('Actual version: {}'.format(__version__)) # Fetching last github tag @@ -90,10 +90,18 @@ if args.update: osintFiles = ['disposable_num_providers.json', 'individuals.json', 'reputation.json', 'social_medias.json'] try: + print('[*] Updating OSINT files') + for file in osintFiles: url = 'https://raw.githubusercontent.com/sundowndev/PhoneInfoga/master/osint/{}'.format(file) output_directory = 'osint/{}'.format(file) download_file(url, output_directory) + + print('[*] Updating python script') + + url = 'https://raw.githubusercontent.com/sundowndev/PhoneInfoga/master/phoneinfoga.py' + output_directory = 'phoneinfoga.py' + download_file(url, output_directory) except: print('Update failed. Try using git pull.') sys.exit()