Advertisement
1337ings

[Python] HaveIBeenPwned

Feb 13th, 2017
1,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. # haveibeenpwned?
  2.  
  3. import requests
  4. import json
  5. import re
  6. import simplejson
  7. a = raw_input("Enter the email:")
  8. r = requests.get("https://haveibeenpwned.com/api/v2/breachedaccount/"+a)
  9. res = json.loads(r.text)
  10. url_pattern = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
  11. a = len(res)
  12. if r.status_code == 200:
  13. print "Email:" , a
  14. for i in res:
  15. print "Domain:" , i['Domain']
  16. print "Leakedaccounts:" , i['PwnCount']
  17. print "Domain:", i['Domain']
  18. print "BreachDate:", i['BreachDate']
  19. print "AddedDate:", i['AddedDate']
  20. links = i['Description']
  21. find_links = re.findall(url_pattern, links)
  22. print "Links:", "\n".join([str(x) for x in find_links])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement