diff --git a/pwnedornot.py b/pwnedornot.py index 69ec18e..585ea1f 100755 --- a/pwnedornot.py +++ b/pwnedornot.py @@ -15,7 +15,7 @@ W = '\033[0m' # white version = '1.2.0' -useragent = {'User-Agent' : 'pwnedornot'} +useragent = {'User-Agent': 'pwnedornot'} start = '' def banner(): @@ -32,9 +32,9 @@ def banner(): / .___/|__/|__/_/ /_/\___/\__,_/\____/_/ /_/ |_/\____/\__/ /_/ ''' - print (G + banner + W) - print (G + '[>]' + C + ' Created by : ' + W + 'thewhiteh4t') - print (G + '[>]' + C + ' Version : ' + W + version + '\n') + print(G + banner + W) + print(G + '[>]' + C + ' Created by : ' + W + 'thewhiteh4t') + print(G + '[>]' + C + ' Version : ' + W + version + '\n') def main(): global addr, start @@ -58,8 +58,8 @@ def main(): check() time.sleep(1.6) elif file != None and domain != None: - print (G + '[+]' + C + ' Reading Emails Addresses from ' + W + '{}'.format(file) + '\n') - print (G + '[+]' + C + ' Domain : ' + W + domain) + print(G + '[+]' + C + ' Reading Emails Addresses from ' + W + '{}'.format(file) + '\n') + print(G + '[+]' + C + ' Domain : ' + W + domain) with open(file) as dict: for line in dict: line = line.strip() @@ -68,20 +68,20 @@ def main(): filtered_check() time.sleep(1.6) else: - print ('\n' + R + '[-]' + C + ' Error : Atleast 1 Argument is Required, Try : python3 pwnedornot.py -h' + W) + print('\n' + R + '[-]' + C + ' Error : Atleast 1 Argument is Required, Try : python3 pwnedornot.py -h' + W) exit() def check(): - print (G + '[+]' + C + ' Checking Breach status for ' + W + '{}'.format(addr), end = '') + print(G + '[+]' + C + ' Checking Breach status for ' + W + '{}'.format(addr), end = '') rqst = requests.get('https://haveibeenpwned.com/api/v2/breachedaccount/{}'.format(addr), headers=useragent, timeout=10) sc = rqst.status_code if sc == 200: - print (G + ' [ pwned ]' + W) + print(G + ' [ pwned ]' + W) json_out = rqst.content.decode('utf-8', 'ignore') simple_out = json.loads(json_out) for item in simple_out: - print ( '\n' + print( '\n' + G + '[+]' + C + ' Breach : ' + W + str(item['Title']) + '\n' + G + '[+]' + C + ' Domain : ' + W + str(item['Domain']) + '\n' + G + '[+]' + C + ' Date : ' + W + str(item['BreachDate']) + '\n' @@ -92,32 +92,32 @@ def check(): if nodumps is not True: dump() elif sc == 404: - print (R + ' [ Not Breached ]' + W) + print(R + ' [ Not Breached ]' + W) if nodumps is not True: dump() elif sc == 503: - print ('\n') - print (R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') + print('\n') + print(R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') elif sc == 403: - print ('\n') - print (R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') + print('\n') + print(R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') else: - print ('\n') - print (R + '[-]' + C + ' An Unknown Error Occurred') - print (rqst.text) + print('\n') + print(R + '[-]' + C + ' An Unknown Error Occurred') + print(rqst.text) def filtered_check(): - print ('\n' + G + '[+]' + C + ' Checking Breach status for ' + W + '{}'.format(addr), end = '') + print('\n' + G + '[+]' + C + ' Checking Breach status for ' + W + '{}'.format(addr), end='') rqst = requests.get('https://haveibeenpwned.com/api/v2/breachedaccount/{}?domain={}'.format(addr, domain), headers=useragent, verify=True, timeout=10) sc = rqst.status_code if sc == 200: - print (G + ' [ pwned ]' + W) + print(G + ' [ pwned ]' + W) json_out = rqst.content.decode('utf-8', 'ignore') simple_out = json.loads(json_out) for item in simple_out: - print ( '\n' + print( '\n' + G + '[+]' + C + ' Breach : ' + W + str(item['Title']) + '\n' + G + '[+]' + C + ' Domain : ' + W + str(item['Domain']) + '\n' + G + '[+]' + C + ' Date : ' + W + str(item['BreachDate']) + '\n' @@ -128,30 +128,30 @@ def filtered_check(): if nodumps is not True: dump() elif sc == 404: - print (R + ' [ Not Breached ]' + W) + print(R + ' [ Not Breached ]' + W) if nodumps is not True: dump() elif sc == 503: - print ('\n') - print (R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') + print('\n') + print(R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') elif sc == 403: - print ('\n') - print (R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') + print('\n') + print(R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') else: - print ('\n') - print (R + '[-]' + C + ' An Unknown Error Occurred') - print (rqst.text) + print('\n') + print(R + '[-]' + C + ' An Unknown Error Occurred') + print(rqst.text) def dump(): dumplist = [] - print ('\n' + G + '[+]' + C + ' Looking for Dumps...' + W, end = '') + print('\n' + G + '[+]' + C + ' Looking for Dumps...' + W, end = '') rqst = requests.get('https://haveibeenpwned.com/api/v2/pasteaccount/{}'.format(addr), headers= useragent, timeout=10) sc = rqst.status_code if sc != 200: - print (R + ' [ No Dumps Found ]' + W) + print(R + ' [ No Dumps Found ]' + W) else: - print (G + ' [ Dumps Found ]' + W + '\n') + print(G + ' [ Dumps Found ]' + W + '\n') json_out = rqst.content.decode('utf-8', 'ignore') simple_out = json.loads(json_out) @@ -164,7 +164,7 @@ def dump(): sc = page.status_code if sc == 200: dumplist.append(url) - print (G + '[+]' + C + ' Dumps Found : ' + W + str(len(dumplist)), end='\r') + print(G + '[+]' + C + ' Dumps Found : ' + W + str(len(dumplist)), end='\r') except requests.exceptions.ConnectionError: pass elif (item['Source']) == 'AdHocUrl': @@ -174,12 +174,12 @@ def dump(): sc = page.status_code if sc == 200: dumplist.append(url) - print (G + '[+]' + C + ' Dumps Found : ' + W + str(len(dumplist)), end='\r') + print(G + '[+]' + C + ' Dumps Found : ' + W + str(len(dumplist)), end='\r') except requests.exceptions.ConnectionError: pass if len(dumplist) != 0: - print ('\n\n' + G + '[+]' + C + ' Passwords:' + W + '\n') + print('\n\n' + G + '[+]' + C + ' Passwords:' + W + '\n') for entry in dumplist: time.sleep(1.1) try: @@ -187,18 +187,18 @@ def dump(): dict = page.content.decode('utf-8', 'ignore') passwd = re.search('{}:(\w+)'.format(addr), dict) if passwd: - print (G + '[+] ' + W + passwd.group(1)) + print(G + '[+] ' + W + passwd.group(1)) elif not passwd: for line in dict.splitlines(): passwd = re.search('(.*{}.*)'.format(addr), line) if passwd: - print (G + '[+] ' + W + passwd.group(0)) + print(G + '[+] ' + W + passwd.group(0)) except requests.exceptions.ConnectionError: pass def domains_list(): domains = [] - print (G + '[+]' + C + ' Fetching List of Breached Domains...' + W + '\n') + print(G + '[+]' + C + ' Fetching List of Breached Domains...' + W + '\n') rqst = requests.get('https://haveibeenpwned.com/api/v2/breaches', headers=useragent, timeout=10) sc = rqst.status_code if sc == 200: @@ -209,26 +209,26 @@ def domains_list(): if len(domain_name) != 0: print (G + '[+] ' + W + str(domain_name)) domains.append(domain_name) - print ('\n' + G + '[+]' + C + ' Total : ' + W + str(len(domains))) + print('\n' + G + '[+]' + C + ' Total : ' + W + str(len(domains))) elif sc == 503: - print (R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') + print(R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') elif sc == 403: - print (R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') + print(R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') else: - print (R + '[-]' + C + ' An Unknown Error Occurred') - print (rqst.text) + print(R + '[-]' + C + ' An Unknown Error Occurred') + print(rqst.text) def domain_check(): - print (G + '[+]' + C + ' Domain Name : ' + W + check_domain, end = '') + print(G + '[+]' + C + ' Domain Name : ' + W + check_domain, end = '') rqst = requests.get('https://haveibeenpwned.com/api/v2/breaches?domain={}'.format(check_domain), headers=useragent, timeout=10) sc = rqst.status_code if sc == 200: json_out = rqst.content.decode('utf-8', 'ignore') simple_out = json.loads(json_out) if len(simple_out) != 0: - print (G + ' [ pwned ]' + W) + print(G + ' [ pwned ]' + W) for item in simple_out: - print ( '\n' + print( '\n' + G + '[+]' + C + ' Breach : ' + W + str(item['Title']) + '\n' + G + '[+]' + C + ' Domain : ' + W + str(item['Domain']) + '\n' + G + '[+]' + C + ' Date : ' + W + str(item['BreachDate']) + '\n' @@ -239,21 +239,21 @@ def domain_check(): + G + '[+]' + C + ' Spam : ' + W + str(item['IsSpamList']) + '\n' + G + '[+]' + C + ' Data Types : ' + W + str(item['DataClasses'])) else: - print (R + ' [ Not Breached ]' + W) + print(R + ' [ Not Breached ]' + W) elif sc == 503: - print ('\n') - print (R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') + print('\n') + print(R + '[-]' + C + ' Error 503 : ' + W + 'Request Blocked by Cloudflare DDoS Protection') elif sc == 403: - print ('\n') - print (R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') + print('\n') + print(R + '[-]' + C + ' Error 403 : ' + W + 'Request Blocked by Cloudflare') else: - print ('\n') - print (R + '[-]' + C + ' An Unknown Error Occurred') - print (rqst.text) + print('\n') + print(R + '[-]' + C + ' An Unknown Error Occurred') + print(rqst.text) def quit(): global start - print ('\n' + G + '[+]' + C + ' Completed in ' + W + str(time.time()-start) + C + ' seconds.' + W) + print('\n' + G + '[+]' + C + ' Completed in ' + W + str(time.time()-start) + C + ' seconds.' + W) exit() try: @@ -283,5 +283,5 @@ try: main() quit() except KeyboardInterrupt: - print ('\n' + R + '[!]' + C + ' Keyboard Interrupt.' + W) + print('\n' + R + '[!]' + C + ' Keyboard Interrupt.' + W) exit()