Ich habe einen Zipfile-Passwort-Cracker entwickelt, der einen Brute-Force-Angriff ausführt. Das Passwort des zipfile ist 1234. Wann immer ich das Programm es gibt mir diesen Fehler laufen:BruteForce-Angriffsprogramm in Python funktioniert nicht
Traceback (most recent call last):
File "C:\Users\Kartikey\Desktop\cracking\bruteforce\bruteforce.py", line 51, in <module>
zf.extractall(password)
File "C:\Python27\lib\zipfile.py", line 1040, in extractall
self.extract(zipinfo, path, pwd)
File "C:\Python27\lib\zipfile.py", line 1028, in extract
return self._extract_member(member, path, pwd)
File "C:\Python27\lib\zipfile.py", line 1069, in _extract_member
targetpath = os.path.join(targetpath, arcname)
File "C:\Python27\lib\ntpath.py", line 84, in join
result_path = result_path + '\\'
TypeError: can only concatenate tuple (not "str") to tuple
Dies ist der Code:
from zipfile import ZipFile
import itertools
#--------------------------------------CHARECTER SET--------------------------------------
pincharsonlynums = '1234'
passcharswithnonumsnocap = 'abcdefghijklmnopqrstuvwxyz'
passcharswithnumsbtnocap = 'abcdefghijklmnopqrstuvwxyz1234567890'
passcharswithnumsandcap = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
count = 1
passwdlength = 0
#--------------------------------------CONFIGURATION--------------------------------------
print "\n1. What charecter set do you want to use?"
print "1 - 1234567890"
print "2 - abcdefghijklmnopqrstuvwxyz"
print "3 - abcdefghijklmnopqrstuvwxyz1234567890"
print "4 - abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
#charsetchoise = input("Your choise (1/2/3/4): ")
passwdlength = input("\n2. Enter the max length of the password you want to generate: ")
#zipfile = input("\n3. Enter the name of the zipfile with path: ")
#--------------------------------------START CRACKING--------------------------------------
while (count != 0):
gen = itertools.combinations_with_replacement(pincharsonlynums,passwdlength) #1
for password in gen: #2
with ZipFile('downloads.zip') as zf:
# try:
zf.extractall(password)
# except:
# print "Failed."
Irgendwelche Ideen?
nun einen anderen Fehler erhalte ich, meine Änderungen –
@KartikeyKushwaha sehen: ändern Sie bitte Ihre Frage nicht zu fragen, was ein neues Problem. Das wäre ein Thema für einen neuen Beitrag. Ihr Passwort ist falsch, fangen Sie diese Ausnahme ab und versuchen Sie eine neue. –
@machineyearning: Ich weiß, du meinst es gut, aber deine Formulierung ist nicht ganz korrekt. Einen Fehler zu posten und der entsprechende Code ist ** ausgezeichnet **. Ja, mehr Forschung wäre hilfreich gewesen, aber viele Anfänger wissen nicht, wie man das macht. Das ist keine so schlechte Frage. –