-2
我开发了一个zipfile密码破解程序,它可以进行蛮力攻击。 zip文件的密码是1234,当过我运行它,它给了我这个错误:BruteForce在python中的攻击程序无法正常工作
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
这是代码:
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."
任何想法?
现在我得到另一个错误,看到我的编辑 –
@KartikeyKushwaha:请不要改变你的问题要问什么是一个新问题。这将成为新职位的主题。你的密码错了,赶上那个异常并尝试一个新的。 –
@machineyearning:我知道你的意思很好,但你的措辞不太正确。发布错误和您的相关代码是**优秀**。是的,更多的研究会有帮助,但许多初学者不知道如何去做。这并不是一个坏问题。 –