Skip to content

Commit

Permalink
refactor: create askInput function to handle output option
Browse files Browse the repository at this point in the history
Fixes #65 - The tool verify if output option is enabled so he disable the logger to ask for command-line user input.
  • Loading branch information
sundowndev committed Jun 6, 2019
1 parent 31d2178 commit ea3d3e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/googlesearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 15 additions & 1 deletion lib/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import json
from lib.colors import *
from lib.args import args
from lib.logger import Logger


def plus(string):
Expand Down Expand Up @@ -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)
8 changes: 4 additions & 4 deletions scanners/footprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----')

Expand Down Expand Up @@ -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':
Expand All @@ -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':
Expand Down

0 comments on commit ea3d3e7

Please sign in to comment.