You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
712 B
28 lines
712 B
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os, sys
|
|
from unrar import rarfile
|
|
|
|
|
|
def rar_attack(file_name):
|
|
file_handle = rarfile.RarFile('c:/Python游戏源码.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') |