diff --git a/lib/googlesearch.py b/lib/googlesearch.py index 744368e26..40c7ac17b 100644 --- a/lib/googlesearch.py +++ b/lib/googlesearch.py @@ -42,7 +42,7 @@ def search(req, stop): while r.status_code != 200: warn('You are temporary blacklisted from Google search. Complete the captcha at the following URL and copy/paste the content of GOOGLE_ABUSE_EXEMPTION cookie : {}'.format(URL)) info('Need help ? Read https://github.com/sundowndev/PhoneInfoga/wiki') - token = input('\nGOOGLE_ABUSE_EXEMPTION=') + token = askInput('\nGOOGLE_ABUSE_EXEMPTION=') googleAbuseToken = '&google_abuse=' + token r = send('GET', URL + googleAbuseToken, headers=headers) diff --git a/lib/output.py b/lib/output.py index 5007e6782..62b3c497a 100644 --- a/lib/output.py +++ b/lib/output.py @@ -9,6 +9,7 @@ import json from lib.colors import * from lib.args import args +from lib.logger import Logger def plus(string): @@ -67,10 +68,23 @@ def throw(string): def askForExit(): if not args.output: - user_input = input("Continue scanning ? (y/N) ") + user_input = askInput('Continue scanning ? (y/N) ') if user_input.lower() == 'y' or user_input.lower() == 'yes': return -1 else: info("Good bye!") sys.exit() + +def askInput(text): + if args.output: + sys.stdout = sys.__stdout__ + sys.stderr = sys.__stderr__ + + res = input(text) + + sys.stdout = Logger() + + return res + else: + return input(text) \ No newline at end of file diff --git a/scanners/footprints.py b/scanners/footprints.py index 57011d12e..b23978586 100644 --- a/scanners/footprints.py +++ b/scanners/footprints.py @@ -152,13 +152,13 @@ def osintScan(numberObject, rerun=False): plus("Scan URL: https://www.411.com/phone/{}".format( internationalNumber.replace('+', '').replace(' ', '-'))) - askingCustomPayload = input( + askingCustomPayload = askInput( 'Would you like to use an additional format for this number ? (y/N) ') if rerun or askingCustomPayload == 'y' or askingCustomPayload == 'yes': info('We recommand: {} or {}'.format(internationalNumber, internationalNumber.replace(numberCountryCode + ' ', ''))) - customFormatting = input('Custom format: ') + customFormatting = askInput('Custom format: ') info('---- Web pages footprints ----') @@ -189,7 +189,7 @@ def osintScan(numberObject, rerun=False): info("Generating URL on scamcallfighters.com...") plus('http://www.scamcallfighters.com/search-phone-{}.html'.format(number)) - tmpNumAsk = input( + tmpNumAsk = askInput( "Would you like to search for temporary number providers footprints ? (Y/n) ") if tmpNumAsk.lower() != 'n' and tmpNumAsk.lower() != 'no': @@ -199,7 +199,7 @@ def osintScan(numberObject, rerun=False): osintIndividualScan() - retry_input = input( + retry_input = askInput( "Would you like to rerun OSINT scan ? (e.g to use a different format) (y/N) ") if retry_input.lower() == 'y' or retry_input.lower() == 'yes':