|
|
@ -12,31 +12,25 @@ def write_to_file(url, fname):
|
|
|
|
with open(fname, "a") as f:
|
|
|
|
with open(fname, "a") as f:
|
|
|
|
f.write(url+"\n")
|
|
|
|
f.write(url+"\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def print_error(err, errstr, var, debug = False):
|
|
|
|
|
|
|
|
if debug:
|
|
|
|
|
|
|
|
print (f"\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m {errstr}\033[93;1m {err}")
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print (f"\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m {errstr}\033[93;1m {var}")
|
|
|
|
|
|
|
|
|
|
|
|
def make_request(url, headers, error_type, social_network):
|
|
|
|
def make_request(url, headers, error_type, social_network):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
r = requests.get(url, headers=headers)
|
|
|
|
r = requests.get(url, headers=headers)
|
|
|
|
if r.status_code:
|
|
|
|
if r.status_code:
|
|
|
|
return r, error_type
|
|
|
|
return r, error_type
|
|
|
|
except requests.exceptions.HTTPError as errh:
|
|
|
|
except requests.exceptions.HTTPError as errh:
|
|
|
|
if DEBUG:
|
|
|
|
print_error(errh, "HTTP Error:", social_network, DEBUG)
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m HTTP Error:\033[93;1m", errh)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m HTTP Error:\033[93;1m", social_network)
|
|
|
|
|
|
|
|
except requests.exceptions.ConnectionError as errc:
|
|
|
|
except requests.exceptions.ConnectionError as errc:
|
|
|
|
if DEBUG:
|
|
|
|
print_error(errc, "Error Connecting:", social_network, DEBUG)
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m Error Connecting:\033[93;1m", errc)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m Error Connecting:\033[93;1m", social_network)
|
|
|
|
|
|
|
|
except requests.exceptions.Timeout as errt:
|
|
|
|
except requests.exceptions.Timeout as errt:
|
|
|
|
if DEBUG:
|
|
|
|
print_error(errt, "Timeout Error:", social_network, DEBUG)
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m Timeout Error:\033[93;1m", errt)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m Timeout Error:\033[93;1m", social_network)
|
|
|
|
|
|
|
|
except requests.exceptions.RequestException as err:
|
|
|
|
except requests.exceptions.RequestException as err:
|
|
|
|
if DEBUG:
|
|
|
|
print_error(err, "Unknown error:", social_network, DEBUG)
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m Unknown error:\033[93;1m", err)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print ("\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m Unknown error:\033[93;1m", social_network)
|
|
|
|
|
|
|
|
return None, ""
|
|
|
|
return None, ""
|
|
|
|
|
|
|
|
|
|
|
|
def sherlock(username):
|
|
|
|
def sherlock(username):
|
|
|
@ -114,12 +108,15 @@ def sherlock(username):
|
|
|
|
|
|
|
|
|
|
|
|
print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Saved: \033[37;1m{}\033[0m".format(username+".txt"))
|
|
|
|
print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Saved: \033[37;1m{}\033[0m".format(username+".txt"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('username', help='check services with given username')
|
|
|
|
parser.add_argument('username', help='check services with given username')
|
|
|
|
parser.add_argument("-d", '--debug', help="enable debug mode", action="store_true")
|
|
|
|
parser.add_argument("-d", '--debug', help="enable debug mode", action="store_true")
|
|
|
|
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
if args.debug:
|
|
|
|
if args.debug:
|
|
|
|
DEBUG = True
|
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
|
|
|
|
if args.username:
|
|
|
|
if args.username:
|
|
|
|
sherlock(args.username)
|
|
|
|
sherlock(args.username)
|