虽说是暴力破解,但是几率不大,除非密码相对简单,否则时间成本根本花不起,密码本里面包含的也有限,只是思路,可以一试。
密码本链接:/s/15fZ3fEDKbXk04vcYQr4TtA
提取码:098k
破解rar文件代码
import rarfile,zipfile,os,shutilfrom pathlib import Pathfrom tqdm import tqdmzip_file = "data.zip"wordlist = "rockyou.txt"fileget=rarfile.RarFile(zip_file)n_words = len(list(open(wordlist, "rb")))# 打印密码总数print("Total passwords to test:", n_words)with open(wordlist, "rb") as wordlist:for word in tqdm(wordlist, total=n_words, unit="word"):try:fileget.extractall(pwd=word.strip())except:continueelse:print("[+] Password found:", word.decode().strip())exit(0)print("[!] Password not found, try other wordlist.")
破解zip文件代码
import zipfilefrom tqdm import tqdmwordlist = "rockyou.txt"# 要破解其密码的rar文件,zip文件zip_file = "data.zip"# 初始化Zip文件对象zip_file = zipfile.ZipFile(zip_file)# 计算此单词列表中的单词数n_words = len(list(open(wordlist, "rb")))# 打印密码总数print("Total passwords to test:", n_words)with open(wordlist, "rb") as wordlist:for word in tqdm(wordlist, total=n_words, unit="word"):try:zip_file.extractall(pwd=word.strip())except:continueelse:print("[+] Password found:", word.decode().strip())exit(0)print("[!] Password not found, try other wordlist.")