使用python暴力破解rar文件,已知密码是12,正常解压也可完成,但是使用程序运行时,还是报error,中间尝试用utf-8编码,也没有用
import rarfile
import random
import time
import sys
zfile = rarfile.RarFile("1.rar")
try:
zfile.extractall(path=".", pwd='12')
#zfile.extractall(path=".", pwd='12'.encode('utf-8'))
print("the password is {}".format('12'))
sys.exit(0)
except Exception as e:
print('error')
pass
压缩包格式是否不兼容,在制作压缩包的时候,选择 rar4 格式看看。