r/PythonProjects2 • u/thot_patrol6942 • Feb 11 '20
hash stuff
errmsg = "sys err"
print("[1] encryptor")
print("[2] decryptor")
what = input("c:\\> ")
if what == "1":
i = 2
while i == 2:
inp = input("word: ")
if inp == "break":
break
hasdinp = hashlib.md5(inp.encode('utf-8').strip()) .hexdigest()
print("le hash: %s"%hasdinp )
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
elif what == "2":
a = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
print("\n password cracker \n")
fileu = input("file directory: ")
inpin = input("whats the method: ")
if inpin.lower() == "md5":
hashu = input("what is the md5 hash: ")
try:
fileo = open(fileu, "r")
except:
print(errmsg)
counter = 1
for passes in fileo:
md5has = hashlib.md5(passes.encode("utf-8").strip()).hexdigest()
print('trying pw %d: %s'%(counter, passes))
print(a)
counter += 1
if hashu == md5has:
print("\n password found: %s \n"%(passes))
fileo.close()
break
else:
print("404 hash not found")
if inpin.lower() == "sha1":
hashu = input("what is the sha1 hash: ")
try:
fileo = open(fileu, "r")
except:
print(errmsg)
counter = 1
for passes in fileo:
sha1has = hashlib.sha1(passes.encode("utf-8").strip()).hexdigest()
print('trying pw %d: %s'%(counter, passes))
print(a)
counter += 1
if hashu == sha1has:
print("\n password found: %s \n"%(passes))
fileo.close()
break
else:
print("404 hash not found")
if inpin.lower() == "sha256":
hashu = input("what is the sha256 hash: ")
try:
fileo = open(fileu, "r")
except:
print(errmsg)
counter = 1
for passes in fileo:
sha256has = hashlib.sha256(passes.encode("utf-8").strip()).hexdigest()
print('trying pw %d: %s'%(counter, passes))
print(a)
counter += 1
if hashu == sha256has:
print("\n password found: %s \n"%(passes))
fileo.close()
break
else:
print("404 hash not found")
else:
print(errmsg) ```
0
Upvotes
5
u/bobdobbsjr Feb 12 '20
Two things. First, you need to fix the formatting. Second, it helps to include some kind of description instead of just posting code.