ZIP压缩包解压密码爆破Python脚本

Mr.Wu 952 3 正在检测是否收录...
import itertools
import string
import zipfile
import asyncio

def save(name,data):
    with open(f'{name}.txt', 'a', encoding='utf-8') as f:
        f.write(data + '\n')

async def try_extract_zip_async(zip_file, password):
    try:
        with zipfile.ZipFile(zip_file, 'r') as zip_file:
            zip_file.extractall(pwd=password.encode())
            save('password',password)
            exit(f"解压成功,密码为: {password}")
    except:
        return None

async def generate_and_try_passwords(zip_file, length):
    characters = string.ascii_letters + string.digits
    passwords = itertools.product(characters, repeat=length)
    
    for password in passwords:
        password_str = ''.join(password)
        result = await try_extract_zip_async(zip_file, password_str)
        if result is not None:
            return result
        
        print(f"尝试密码 '{password_str}' 不正确。")

async def main(password_length):
    zip_file = r"C:\Users\admin\Desktop\123.zip"  # 替换为实际的ZIP文件路径
    
    await generate_and_try_passwords(zip_file, password_length)

if __name__ == "__main__":
	for x in range(5,7):
		asyncio.run(main(x))

打赏
发表评论 取消回复
表情 图片 链接 代码

  1. 安安
    安安 Lv 1

    经常来看你,就是好久没更新了

  2. 九凌网络

    会继续关注

  3. 流量卡知识网

    你好,看完你的博客文章,感觉很不错!希望与你网站首页友情链接
    流量卡知识网
    http://53go.cn/
    专注于移动 / 联通 / 电信运营商官方推出的大流量多语音活动长短期套餐手机卡的相关知识的介绍普及

    听说互换友情链接可以增加网站的收录量,特此来换,如果同意的话就给 internetyewu@163.com[微信 ganenboy] 发信息或者就在此回复下吧!【建站问题也可以一起讨论!】

分享
微信
微博
QQ