added testpw.py
testpw.py takes password as argument and checks it against haveibeenpawned or not in a secure way
This commit is contained in:
17
testpw.py
Normal file
17
testpw.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
import hashlib
|
||||
import requests
|
||||
|
||||
url="https://api.pwnedpasswords.com/range/"
|
||||
hash_object = hashlib.sha1(sys.argv[1].encode("UTF-8"))
|
||||
pw_hash=hash_object.hexdigest()
|
||||
first_part=pw_hash[:5]
|
||||
second_part=pw_hash[5:]
|
||||
print(pw_hash)
|
||||
print(first_part)
|
||||
print(second_part)
|
||||
furl="{}{}".format(url,first_part)
|
||||
print(furl)
|
||||
response=requests.get(furl)
|
||||
if second_part.lower() in response.text.lower():
|
||||
print("hash found")
|
||||
Reference in New Issue
Block a user