压缩包密码破解示例分享(类似典破解)
发布时间:2022-10-17 17:03:37
标签:压缩包密码破解
昨天翻硬盘,找到一个好东西,可惜自己加了密码自己不记得了。试了几个常用的没试出来,于是写了这么个小脚本来替我尝试。。呵呵,还真给解出来了。
python脚本内容如下,跑跑自己加密的压缩包还不错
# -*- coding: utf-8 -*-
import sys,os
def IsElementUniq(list):
"""
判断list中的元素是否为唯一的
"""
for word in list:
if list.count(word)>1:
return False
return True
def GenPswList():
"""
要求用户输入词,并根据单词组合密码,只尝试四个单词来组合,并限制密码长度为20。写的比较挫
"""
psw=raw_input('input a word>')
wordlist = []
while psw:
wordlist.append(psw)
psw=raw_input('input a word>')
print wordlist
global g_pswlist
g_pswlist = []
for word in wordlist:
g_pswlist.append(word)
for word1 in wordlist:
for word2 in wordlist:
locallist = [word1, word2]
if IsElementUniq(locallist):
tmp = word1 + word2
if len(tmp) < 20:
g_pswlist.append(tmp)
for word1 in wordlist:
for word2 in wordlist:
for word3 in wordlist:
locallist = [word1, word2, word3]
if IsElementUniq(locallist):
tmp = word1 + word2 + word3
if len(tmp) < 20:
g_pswlist.append(tmp)
for word1 in wordlist:
for word2 in wordlist:
for word3 in wordlist:
for word4 in wordlist:
locallist = [word1, word2, word3, word4]
if IsElementUniq(locallist):
tmp = word1 + word2 + word3 + word4
if len(tmp) < 20:
g_pswlist.append(tmp)
print 'gen psw is:', g_pswlist
def TestUnZipPack(filename):
"""
尝试用密码来解压压缩包
"""
command = ""
for psw in g_pswlist:
command = "7z e -p%s -y %s" %(psw,filename)
print command
ret = os.system(command)
if ret == 0:
print 'right psw is ', psw
break
def main(filename):
GenPswList()
TestUnZipPack(filename)
if __name__ == '__main__':
if len(sys.argv) != 2:
print 'argv error'
print 'example:test_7z_psw.py 1.7z'
sys.exit(1)
main(sys.argv[1])


猜你喜欢
- 下面记录一下在本地 Windwos 环境用 vagrant 搭建的虚拟机(Homestaead)和生产环境阿里云 CentOS 系统安装 N
- 本文实例为大家分享了python实现移位加密和解密的具体代码,供大家参考,具体内容如下代码很简单,就不多做解释啦。主要思路是将字符串转为As
- MySQL时间盲注五种延时方法 (PWNHUB 非预期解)延时注入函数五种:sleep(),benchmark(t,exp),笛卡尔积,GE
- pyinstaller打包引入自己编写的库场景使用pyinstaller打包某个文件后,生成的exe文件无法运行,提示 Module not
- 案例描述在定时脚本运行过程中,发现当备份表格的sql语句与删除该表部分数据的sql语句同时运行时,mysql会检测出死锁,并打印出日志。两
- 操作步骤进入命令行环境。我使用的是conda。有两种方式进入命令行。方法1:通过anconda navigator界面,选择environm
- py2exe在sourceforge 的下载只支持到2.7。针对python3.0+的版本,需要自己编译。1.下载源码svn checkou
- OOM全称"Out Of Memory",即内存溢出。内存溢出已经是软件开发历史上存在了近40年的“老大难”问题。在操作
- 环境变量配置首先需要将anaconda的路径配置进环境变量中,我是用户变量和系统变量都配置了。我的anaconda安装在D:\Anacond
- 年关将至,大家对疫情的关注度也愈发提升,本次使用PyQt5撰写100行代码写一个疫情信息快速查看工具。一.准备工作1.PyQt5PyQt 是
- 在Python语言中最常见的括号有三种,分别是:小括号()、中括号[]、花括号{};其作用也不相同,分别用来代表不同的Python基本内置数
- 引入依赖#?导入模块import?pymysqlimport?pandas?as?pdimport?numpy?as?npimport?ti
- 1.前期准备用户models.pyclass User(models.Model): username = mod
- 代码如下:Class Vector Private vector_datas() Private&n
- 一、查询操作可以使用Dataframe的index属性和columns属性获取行、列索引。import pandas as pddata =
- 这篇文章主要介绍了python解析命令行参数的三种方法详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要
- 启动targetcli时遭遇ImportError: cannot import name ALUATargetPortGrou
- 今天摸了半天摸出来的,虽然这里没啥人玩ASP,不过也是win7的问题,发发当备份问题1.An error occurre
- 上回 说到“大屏幕浏览页面的良好体验,本就应该用户自己调整窗口。”根据屏幕不同大小,缩小窗口出横向滚动条在所难免,但理想情况下,页面应该能适
- 图表是比干巴巴的表格更直观的表达,简洁、有力。工作中经常遇到的场景是,有一些数值需要定时的监控,比如服务器的连接数、活跃用户数、点击某个按钮