nach 3 Tagen traue ich mich hier meine Frage zu stellen. Ich bin noch an den Anfängen von Python und versuche meine ersten Programme/Scripte zu schreiben. Nun hänge ich an meinem Zip Brute Forcer. Ich kriege die Meldung: pwd: expected bytes, got <class 'str'>. Nach langer recherche und blick ins Manual finde ich keinen anderen Weg als hier die Frage zu stellen...
hier mein Code:
Code: Alles auswählen
import zipfile
zip= input("Deine Zip Datei: ")
zip_file = zipfile.ZipFile(zip)
output_verbose = 2
password_list = input("Bitte geben Sie ihr Wörterbuch an: ")
print(type(password_list))
with open(password_list,'rb'):
for index, line in enumerate(password_list):
try:
pwd = line.strip()
zip_file.extractall(pwd=pwd)
except RuntimeError:
if index % output_verbose == 0:
print('{}. Das {} Wort stimmt nicht.'.format(index + 1, pwd))
else:
print('{}. Super ! gefundens Passwort: {}'.format(index + 1, pwd))
break
zip_file.close()
Code: Alles auswählen
import zipfile
zip_file = zipfile.ZipFile('evil.zip')
output_verbose = 2
with open('wörterbuch.txt', 'rb') as password_list:
for index, line in enumerate(password_list):
try:
pwd = line.strip(b'\n')
zip_file.extractall(pwd=pwd)
except RuntimeError:
if index % output_verbose == 0:
print('{}. Das {} Passwort stimmt nicht.'.format(index + 1, pwd))
else:
print('{}. super ! Passwort lautet: {}'.format(index + 1, pwd))
break
zip_file.close()