Reorganise gists folder

This commit is contained in:
TKE
2022-05-13 12:49:21 +02:00
parent ecd3c7fe2f
commit acd8d616dc
98 changed files with 63 additions and 20 deletions

26
codegrab/testpw.py Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/python3
import sys
import hashlib
import requests
if len(sys.argv) != 2:
print("Usage: python testpw.py <password>")
exit(1)
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)
furl="{}{}".format(url,first_part)
print("Das gehashte Passwort lautet: {}".format(pw_hash))
print("Es werden lediglich die ersten 5 Zeichen des Hashes übertragen ({})".format(first_part))
print("Dies lässt keinerlei Rückschlusse auf da Passwort zu.")
response=requests.get(furl)
for line in response.text.splitlines():
if second_part.lower() in line.lower():
print("Passwort wurde {} mal im Datenbestand gefunden".format(line.split(":")[1]))
exit(0)
print("Passwort wurde nicht im Datenbestand gefunden")