Python暴力破解zip、rar的入门到放弃

在开始写正常的破解之前,我想先问一下,大家查这个问题是想练练Python写代码和调用库还是真想破解点啥。

练练代码直接看文末代码就可以了。

要是想破解的话,只能说we are too young too simple。

网络上目前疯传的解决方式只是针对

压缩文件的传统加密方式的暴力破解

谁加密的时候会手残点这个。让我们破解完

-------------------------------------------------------------------------------------

是时候给你们介绍一下压缩软件了

科学的路上充满荆棘,但也不要企图把精力过多的放在错误的方向上。If you have the way,i am glad you can tell me.

-----------------------------------------------------------------------------------------

import  zipfile

zFile = zipfile.ZipFile("E:/Kevin/Python/TEST/test.ZIP");
print(zFile.namelist())
#zFile.extractall(pwd='123456'.encode('utf-8'))

zipInfo = zFile.getinfo('123.txt')
print ('filename:', zipInfo.filename) #获取文件名称
print ('date_time:', zipInfo.date_time) #获取文件最后修改时间。返回一个包含6个元素的元组:(年, 月, 日, 时, 分, 秒)
print ('compress_type:', zipInfo.compress_type) #压缩类型
print ('comment:', zipInfo.comment) #文档说明
print ('extra:', zipInfo.extra) #扩展项数据
print ('create_system:', zipInfo.create_system) #获取创建该zip文档的系统。
print ('create_version:', zipInfo.create_version) #获取 创建zip文档的PKZIP版本。
print ('extract_version:', zipInfo.extract_version) #获取 解压zip文档所需的PKZIP版本。
print ('extract_version:', zipInfo.reserved) # 预留字段,当前实现总是返回0。
print ('flag_bits:', zipInfo.flag_bits) #zip标志位。
print ('volume:', zipInfo.volume) # 文件头的卷标。
print ('internal_attr:', zipInfo.internal_attr) #内部属性。
print ('external_attr:', zipInfo.external_attr) #外部属性。
print ('header_offset:', zipInfo.header_offset) # 文件头偏移位。
print ('CRC:', zipInfo.CRC) # 未压缩文件的CRC-32。
print ('compress_size:', zipInfo.compress_size) #获取压缩后的大小。
print ('file_size:', zipInfo.file_size) #获取未压缩的文件大小。

passwordfile=open('E:/Kevin/Python/TEST/Dictionary/dictionary.txt')
print(passwordfile)
for line in passwordfile.readlines():   #逐行读取
    password=line.strip('\n')  #去除换行符  
    try:
       zFile.extractall(path='E:/Kevin/Python/TEST/', pwd='123456'.encode('ascii'))
       print('the password is: '+ password)
       break  #读取到正确密码就退出循环
    except Exception as e:   #打印报错
       print(e)

#zFile.extractall(path='E:/Kevin/Python/TEST/',pwd='456789'.encode('ascii'))

若果在我上面的一段话后,你还有耐心看到这里,那么恭喜你,你距离非正常破解密码的路更近了一步,

那是什么呢?请听下回分解。无招胜有招,看你的思路。

发布了19 篇原创文章 · 获赞 2 · 访问量 3243

猜你喜欢

转载自blog.csdn.net/qq_39729096/article/details/105337934
今日推荐