I have developed a zipfile password cracker which does a brute force attack. The password of the zipfile is 1234. When ever I run the program it gives me this error:
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
This is the 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."
Any ideas?