i have been trying make simple zip file password cracker (just fun, not malicious purposes) try , except statement not work. no matter input leads except statement, , else never executed (even though zip file extract)
import zipfile k = 0 file = zipfile.zipfile('john.zip') def check(i): p = bytes(i, 'ascii') try: file.extractall(pwd=p) except: return false else: return true def crack(): x = open('john(1).txt', 'r') in x.readlines(): i.strip('\n') k = check(i) if k == true: print('password is: ' + k) break; x.close() x.close()`
1) log error in except block. helps lot.
2) closing file in 'for' loop. bad idea loop reads lines file.
3) last line has reverse quote character @ end (may typo in question): `
Comments
Post a Comment