美文网首页Py
python破解rar密码

python破解rar密码

作者: f09037cb27f7 | 来源:发表于2018-04-04 22:15 被阅读55次

前期准备:
此程序是在window平台上使用的
需要安装WinRAR软件,并把winrar加入系统的环境变量


环境变量--系统变量

准备一个带密码的w.rar文件,放到代码同级目录

# -*- coding:utf8 -*-
#!/usr/bin/env python

import os

for i in range(12340,100000):
    p = str(i)
    cmd = "winrar e w.rar -y -p%s" %(p)

    r = os.system(cmd)
    if r == 1 or r == 0:
        print("Password: %s" %(p))
        break
    print("%s %d" %(p, r))

执行效率有点慢,等学会多线程了再试试多线程


相关文章

网友评论

    本文标题:python破解rar密码

    本文链接:https://www.haomeiwen.com/subject/yfilhftx.html