Created
February 22, 2018 00:17
-
-
Save ShakataGaNai/cb786a2c64abc83d4dbe0dbf6b60a5e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from getpass import getpass | |
import hashlib | |
import requests | |
import sys | |
import re | |
passd = getpass('Gimme your password: ') | |
hash = hashlib.sha1(passd).hexdigest().upper() | |
res = requests.get('https://api.pwnedpasswords.com/range/'+hash[0:5]) | |
if res.status_code != 200: | |
print("Error talking to API") | |
sys.exit() | |
for line in res.text.split("\n"): | |
if hash[5:] in line: | |
x = line.split(":") | |
print("") | |
print("Your password is UNSAFE! Seen {} times in PwnedPasswords.com database".format(re.sub("[^0-9]","",x[1]))) | |
sys.exit() | |
print("Your password is not in the PwnedPasswords.com database") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment