600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > Python暴力破解受密码保护的zip/rar文件

Python暴力破解受密码保护的zip/rar文件

时间:2024-05-14 21:36:03

相关推荐

Python暴力破解受密码保护的zip/rar文件

虽说是暴力破解,但是几率不大,除非密码相对简单,否则时间成本根本花不起,密码本里面包含的也有限,只是思路,可以一试。

密码本链接:/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.")

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。