-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathEmail_Scan.py
More file actions
48 lines (40 loc) · 1.61 KB
/
Email_Scan.py
File metadata and controls
48 lines (40 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from wsgiref import headers
import requests
import json
def GetEmail():
email = input("Enter the Email : ")
HaveIbeenPwned(email)
def HaveIbeenPwned(email):
url = "https://www.troyhunt.com/authentication-and-the-have-i-been-pwned-api/"+email
header = {'hibp-api-key': '58779e4f5a4d427a9cb3175dcc3b3f58'}
print('')
print("Checking for Breached Data")
print('')
rqst = requests.get(url,headers=header,timeout=10)
sc = rqst.status_code
if sc == 200:
print("The Email has been Breached")
json_out = rqst.content.decode('utf-8', 'ignore')
simple_out = json.loads(json_out)
for item in simple_out:
print('\n'
'[+] Breach : ' + str(item['Title']) + '\n'
'[+] Domain : ' + str(item['Domain']) + '\n'
'[+] Date : ' + str(item['BreachDate']) + '\n'
'[+] Fabricated : ' + str(item['IsFabricated']) + '\n'
'[+] Verified : ' + str(item['IsVerified']) + '\n'
'[+] Retired : ' + str(item['IsRetired']) + '\n'
'[+] Spam : ' + str(item['IsSpamList']))
elif sc == 404:
print('The Email is Not Breached')
elif sc == 503:
print('\n')
print('[-] Error 503 : Request Blocked by Cloudflare DDoS Protection')
elif sc == 403:
print('\n')
print('[-] Error 403 : Request Blocked by haveibeenpwned API')
print(rqst.text)
else:
print('\n')
print('[-] An Unknown Error Occurred')
print(rqst.text)