忘记rar密码python解决

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os,sys
from unrar import rarfile

def rar_attack(file_name):

    file_handle = rarfile.RarFile('test.rar')
    handle_password = open('passwords.txt')
    for pwd in handle_password:
        pwd = pwd.rstrip()
        try:
            file_handle.extractall(path='test', pwd=pwd.encode())
            print('Found:'+pwd)
            break
        except:
            pass
    handle_password.close()
    file_handle.close()
    
if __name__=='__main__':
    file_name = sys.argv[1]
    if os.path.isfile(file_name) and file_name.endswith('.rar'):
        rar_attack(file_name)
    else:
        print('Not RAR')

三种方法快速破解rar密码 - 知乎

相关推荐
powerfulzyh6 分钟前
Ubuntu24.04远程开机
linux·ubuntu·远程工作
ulimpid6 分钟前
Command | Ubuntu 个别实用命令记录(新建用户、查看网速等)
linux·ubuntu·command
HHoao7 分钟前
Ubuntu启动后第一次需要很久才能启动GTK应用问题
linux·运维·ubuntu
小灰兔的小白兔9 分钟前
【Ubuntu】Ubuntu常用命令
linux·运维·ubuntu
GFCGUO11 分钟前
ubuntu18.04运行OpenPCDet出现的问题
linux·python·学习·ubuntu·conda·pip
winds~12 分钟前
ubuntu中软件的进程管理-结束软件运行
linux·运维·ubuntu
阳光不锈@39 分钟前
麒麟桌面系统安装和配置Node.js
linux·麒麟系统安装node.js
叫我龙翔2 小时前
【Linux】进程间关系与守护进程
linux·运维·服务器·计算机网络
小诸葛的博客2 小时前
Ubuntu如何如何安装tcpdump
linux·ubuntu·tcpdump
S hh2 小时前
【Linux】进程地址空间
java·linux·运维·服务器·学习