您的位置首页百科知识

使用Python解压数字加密的压缩包

使用Python解压数字加密的压缩包

的有关信息介绍如下:

使用Python解压数字加密的压缩包

使用Python解压数字加密的压缩包

如图,我们要解压dda这个加了密码的压缩包,一般数字密码的压缩包可以直接使用暴力解压撞击的方式。

先打开Python脚本编辑。

然后输入代码,使它读取压缩包:

z = zipfile.ZipFile(r"C:\Users\Administrator\Desktop\bbb\dda.zip","r")

然后,列出数字密码出现的可能,并组合。

组合方式如下:

for m2 in arrry:

for m22 in arrry:

pw = m2.encode("utf-8") + m22.encode("utf-8")

try:

z.extractall(pwd = pw,path =r"C:\Users\Administrator\Desktop\bbb")

print("password:" + pw)

z.close()

exit()

except:

pass

网上很多朋友的写法是读取字典,还要生成字典。我这种,不需要读取字典,自己列举。

整个解压Python脚本如下:

# -*- coding: utf-8 -*-

import zipfile

z = zipfile.ZipFile(r"C:\Users\Administrator\Desktop\bbb\dda.zip","r")

arrry = []

for s in range(10):

arrry.append(chr(s+48))

#for d in range(26):

#arrry.append(chr(d+65))

#for x in range(26):

#arrry.append(chr(x+97))

print("1")

for m1 in arrry:

pw =m1.encode("utf-8")

try:

z.extractall(pwd = pw,path = r"C:\Users\Administrator\Desktop\bbb")

z.close()

print(m1.encode("utf-8"))

exit()

except:

pass

del pw

print("2")

for m2 in arrry:

for m22 in arrry:

pw = m2.encode("utf-8") + m22.encode("utf-8")

try:

z.extractall(pwd = pw,path =r"C:\Users\Administrator\Desktop\bbb")

print("password:" + pw)

z.close()

exit()

except:

pass

del pw

print("3")

for m3 in arrry:

for m33 in arrry:

for m333 in arrry:

pw = m3.encode("utf-8") + m33.encode("utf-8") + m333.encode("utf-8")

try:

z.extractall(pwd = pw,path =r"C:\Users\Administrator\Desktop\bbb")

z.close()

print("password:" + pw)

exit()

except:

pass

del pw

print("4")

for m4 in arrry:

for m44 in arrry:

for m444 in arrry:

for m4444 in arrry:

pw = m4.encode("utf-8") + m44.encode("utf-8") + m444.encode("utf-8") + m4444.encode("utf-8")

try:

z.extractall(pwd = pw,path =r"C:\Users\Administrator\Desktop\bbb")

z.close()

print("password:" + pw)

exit()

except:

pass

del pw

print("5")

for m5 in arrry:

for m55 in arrry:

for m555 in arrry:

for m5555 in arrry:

for m55555 in arrry:

pw = m5.encode("utf-8") + m55.encode("utf-8") + m555.encode("utf-8") + m5555.encode("utf-8") + m55555.encode("utf-8")

try:

z.extractall(pwd = pw,path =r"C:\Users\Administrator\Desktop\bbb")

z.close()

print("password:" + pw)

exit()

except:

pass

del pw

print("6")

for m6 in arrry:

for m66 in arrry:

for m666 in arrry:

for m6666 in arrry:

for m66666 in arrry:

for m666666 in arrry:

pw = m6.encode("utf-8") + m66.encode("utf-8") + m666.encode("utf-8") + m6666.encode("utf-8") + m66666.encode("utf-8") + m666666.encode("utf-8")

try:

z.extractall(pwd = pw,path =r"C:\Users\Administrator\Desktop\bbb")

z.close()

print("password:" + pw)

exit()

except:

pass

del pw

del arrry

可复制粘贴。

最后,运行脚本,就可以实现在忘记密码的情况下,解压压缩包,5位密码以下的1分钟就可以识别密码,5位以上的约10分钟网上。

如果密码更长,则还需要添加代码。