测试环境:win11
使用方法:复制到记事本,另存为,文件类型所有文件,编码ansi,文件名xxx.bat,bat固定不变,xxx随意
支持加密压缩包格式:rar/zip/7z
@echo off
setlocal enabledelayedexpansion
title 字母数字压缩包解密工具
echo 字母数字压缩包解密工具
echo 作者:phenix221
echo 邮箱:279682817@qq.com
echo.
echo 48:0>%temp%\alphat.txt
echo 49:1>>%temp%\alphat.txt
echo 50:2>>%temp%\alphat.txt
echo 51:3>>%temp%\alphat.txt
echo 52:4>>%temp%\alphat.txt
echo 53:5>>%temp%\alphat.txt
echo 54:6>>%temp%\alphat.txt
echo 55:7>>%temp%\alphat.txt
echo 56:8>>%temp%\alphat.txt
echo 57:9>>%temp%\alphat.txt
echo 97:a>>%temp%\alphat.txt
echo 98:b>>%temp%\alphat.txt
echo 99:c>>%temp%\alphat.txt
echo 100:d>>%temp%\alphat.txt
echo 101:e>>%temp%\alphat.txt
echo 102:f>>%temp%\alphat.txt
echo 103:g>>%temp%\alphat.txt
echo 104:h>>%temp%\alphat.txt
echo 105:i>>%temp%\alphat.txt
echo 106:j>>%temp%\alphat.txt
echo 107:k>>%temp%\alphat.txt
echo 108:l>>%temp%\alphat.txt
echo 109:m>>%temp%\alphat.txt
echo 110:n>>%temp%\alphat.txt
echo 111:o>>%temp%\alphat.txt
echo 112:p>>%temp%\alphat.txt
echo 113:q>>%temp%\alphat.txt
echo 114:r>>%temp%\alphat.txt
echo 115:s>>%temp%\alphat.txt
echo 116:t>>%temp%\alphat.txt
echo 117:u>>%temp%\alphat.txt
echo 118:v>>%temp%\alphat.txt
echo 119:w>>%temp%\alphat.txt
echo 120:x>>%temp%\alphat.txt
echo 121:y>>%temp%\alphat.txt
echo 122:z>>%temp%\alphat.txt
echo 65:A>>%temp%\alphat.txt
echo 66:B>>%temp%\alphat.txt
echo 67:C>>%temp%\alphat.txt
echo 68:D>>%temp%\alphat.txt
echo 69:E>>%temp%\alphat.txt
echo 70:F>>%temp%\alphat.txt
echo 71:G>>%temp%\alphat.txt
echo 72:H>>%temp%\alphat.txt
echo 73:I>>%temp%\alphat.txt
echo 74:J>>%temp%\alphat.txt
echo 75:K>>%temp%\alphat.txt
echo 76:L>>%temp%\alphat.txt
echo 77:M>>%temp%\alphat.txt
echo 78:N>>%temp%\alphat.txt
echo 79:O>>%temp%\alphat.txt
echo 80:P>>%temp%\alphat.txt
echo 81:Q>>%temp%\alphat.txt
echo 82:R>>%temp%\alphat.txt
echo 83:S>>%temp%\alphat.txt
echo 84:T>>%temp%\alphat.txt
echo 85:U>>%temp%\alphat.txt
echo 86:V>>%temp%\alphat.txt
echo 87:W>>%temp%\alphat.txt
echo 88:X>>%temp%\alphat.txt
echo 89:Y>>%temp%\alphat.txt
echo 90:Z>>%temp%\alphat.txt
set beginTime=%time%
set strs=
set lengths=
set lastStrFlag=0
set cmpBreakFlag=0
set curPath=
for /f %%j in ('cd') do (
set curPath=%%j
)
set /p rarFile=请输入压缩包路径如C:\test.rar:
echo.
set /p rarRoot=请输入7-Zip主目录如C:\Program Files\7-Zip:
echo.
set /p breakFlag=需要记录最后一次的密码吗,下次将可以从此密码继续计算?输入1需要,输入其他字符不需要:
if not exist breakText.txt (
echo.>breakText.txt
)
set fileHash=
set fileName=
if !breakFlag! equ 1 (
for /f "usebackq tokens=2 delims= " %%a in (`powershell -command "& {get-filehash !rarFile!}"^|find "SHA256"`) do (
set fileHash=%%a
)
for /f "usebackq" %%g in (`dir /b "!rarFile!"`) do (
set fileName=%%g
)
if exist breakText.txt (
set fileHash1=
set fileName1=
set funcName=
set strs=
set lengths=
for /f "tokens=1,2,3,4,5 delims= " %%b in (breakText.txt) do (
set fileHash1=%%b
set fileName1=%%c
set funcName=%%d
set strs=%%e
set lengths=%%f
)
if "!fileHash!" equ "!fileHash1!" (
set /p fileFlag=是否从上一次中断开始解密!fileName!文件,1:是 其他字符:否:
if !fileFlag! equ 1 (
set cmpBreakFlag=1
set ln=1
for /l %%t in (1,0,1) do (
if "!funcName!" equ "d" (
call:diguiDigit !ln! !ln!
) else (
if "!funcName!" equ "a" (
call:diguiAlphat !ln! !ln!
) else (
call:diguiMix !ln! !ln!
)
)
set /a ln=!ln!+1
)
)
)
)
)
)
echo 请回忆以下字母数字密码关键字的情况:
echo 1.姓名首字母或全拼 2.生日日期或日期时间
echo 3.年龄 4.身体数据如身高体重 5.特殊日期
echo 6.qq/微信号 7.对你重要人的信息 8.曾用过的密码
echo 9.一段有意义的文字如诗句 10.与内容有关的密码
echo 11.学号 12.重复数字密码如6666/8888 13.地址
echo 14.身份证号全部或部分 15.网址 16.网名/昵称
echo 17.以上组合
echo.
echo 请尝试用以下方式找回:
echo 1.询问文件作者 2.压缩包注释 3.压缩包使用说明
echo 4.自己尝试回忆部分的密码关键词找回
echo 5.把可能的密码写入本程序所在目录下historyPwd.txt
echo 一行一个密码,程序精确匹配或使用忽略大小写
echo 帮助尝试找回(跳过数字)
echo.
pause
if not exist historyPwd.txt (
echo.>historyPwd.txt
)
echo 正在读取压缩包注释,查找是否包含网址、密码关键词并尝试解密
echo.
set curPath=
for /f %%j in ('cd') do (
set curPath=%%j
)
cd /d "!rarRoot!"
for /l %%c in (1,1,2) do (
if %%c equ 1 (
call:checkPwd 网址
)
if %%c equ 2 (
call:checkPwd 密码
)
)
cd /d !curPath!
echo 正在初始化historyPwd.txt
echo.
copy /y /b historyPwd.txt historyPwd1.txt>nul
echo.>historyPwd.txt
set firstTime=1
for /f %%k in (historyPwd1.txt) do (
set historyFlag=0
for /f "usebackq" %%l in (`findstr /r /m "^%%k$" historyPwd.txt`) do (
set historyFlag=1
)
if "!historyFlag!" equ "0" (
if "!firstTime!" equ "1" (
echo %%k>historyPwd.txt
set firstTime=0
) else (
echo %%k>>historyPwd.txt
)
)
)
del /q historyPwd1.txt
echo 正在读取historyPwd.txt历史密码文件并尝试解密
echo 您可以在本程序同级目录下新建historyPwd.txt文件,
echo 并可以手动在此文件中录入待校验的密码,
echo 格式为每行一个密码
for /f %%f in (historyPwd.txt) do (
call:checkPwd1 %%f
)
echo.
cd /d !curPath!
echo 正在读取historyPwd.txt历史密码文件并尝试使用忽略大小写方式解密
for /f %%r in (historyPwd.txt) do (
call:changFormAndCheck %%r
)
if exist ignoreList.txt (
del /q ignoreList.txt
)
echo.
set /p len1=请输入最小位数,不知道位数直接回车:
echo.
set /p len2=请输入最大位数,不知道位数直接回车:
echo.
set /p pwdType=请输入密码类型1:纯数字,2:纯字母,其他字符:混合,不知道类型直接回车:
echo.
set /p quanzhong=请输入权重顺序(密码类型不选时使用)1:数字2:字母3:混合,比如输入123表示优先数字,其次字母,最后混合,不设置直接回车:
echo.
cd /d "!rarRoot!"
set len=1
for /l %%t in (1,0,1) do (
set loopFlag=
if not "!len1!"=="" (
if !len! geq !len1! (
set loopFlag=1
) else (
set loopFlag=0
)
) else (
set loopFlag=1
)
if not "!len2!"=="" (
if !len! leq !len2! (
set loopFlag=!loopFlag!1
) else (
exit
)
) else (
set loopFlag=!loopFlag!1
)
if "!loopFlag!" equ "11" (
if "!quanzhong!" equ "" (
if "!pwdType!" equ "" (
call:diguiMix !len! !len!
) else (
if "!pwdType!" equ "1" (
call:diguiDigit !len! !len!
) else (
if "!pwdType!" equ "2" (
call:diguiAlphat !len! !len!
) else (
call:diguiMix !len! !len!
)
)
)
) else (
set quanzhong1=!quanzhong:~0,1!
set quanzhong2=!quanzhong:~1,1!
set quanzhong3=!quanzhong:~2!
for /l %%b in (1,1,3) do (
set quanzhong4=
if %%b equ 1 (
set quanzhong4=!quanzhong1!
)
if %%b equ 2 (
set quanzhong4=!quanzhong2!
)
if %%b equ 3 (
set quanzhong4=!quanzhong3!
)
if "!quanzhong4!" equ "1" (
call:diguiDigit !len! !len!
) else (
if "!quanzhong4!" equ "2" (
call:diguiAlphat !len! !len!
) else (
call:diguiMix !len! !len!
)
)
)
)
)
set /a len=!len!+1
)
:diguiMix
for /f "tokens=2 delims=:" %%a in ('type %temp%\alphat.txt') do (
set cmpFlag=1
if "!cmpBreakFlag!" equ "1" (
if %1 lss !lengths! (
exit /b
)
set cmpFlag=0
if %1 gtr !lengths! (
set cmpFlag=1
) else (
set /a starts=%1-%2+1
call set "j=%%strs:~0,!starts!%%"
set num0=%3%%a
if !num0! equ !j! (
set cmpFlag=1
if %2 equ 1 (
set lastStrFlag=1
)
) else (
set cmpFlag=!lastStrFlag!
)
)
)
if !cmpFlag! equ 1 (
if %2 gtr 1 (
set /a num=%2-1
call:diguiMix %1 !num! %3%%a
) else (
cd /d "!rarRoot!"
set pwd3=%3%%a
set checkCharFlag=0
for /f "usebackq tokens=*" %%i in (`7z.exe t !rarFile! -p!pwd3! -bse0^|find "Ok"`) do (
set checkCharFlag=1
)
if "!checkCharFlag!" equ "0" (
echo password !pwd3! is fail^^!
cd /d "!curPath!"
if !breakFlag! equ 1 (
set breakTxt=!fileHash! !fileName! m !pwd3! %1
echo !breakTxt!>breakText.txt
)
)
if "!checkCharFlag!" equ "1" (
cd /d "!curPath!"
cls
echo !beginTime!
echo rar password is !pwd3!^^!
echo !pwd3!>密码.txt
start 密码.txt
echo !pwd3!>>historyPwd.txt
echo %time%
pause
exit
)
)
)
)
exit /b
:diguiDigit
for /l %%a in (0,1,9) do (
set cmpFlag=1
if "!cmpBreakFlag!" equ "1" (
if %1 lss !lengths! (
exit /b
)
set cmpFlag=0
if %1 gtr !lengths! (
set cmpFlag=1
) else (
set /a starts=%1-%2+1
call set "j=%%strs:~0,!starts!%%"
set num0=%3%%a
if !num0! geq !j! (
set cmpFlag=1
)
)
)
if !cmpFlag! equ 1 (
if %2 gtr 1 (
set /a num=%2-1
call:diguiDigit %1 !num! %3%%a
) else (
cd /d "!rarRoot!"
set pwd0=%3%%a
set checkCharFlag=0
for /f "usebackq tokens=*" %%i in (`7z.exe t !rarFile! -p!pwd0! -bse0^|find "Ok"`) do (
set checkCharFlag=1
)
if "!checkCharFlag!" equ "0" (
echo password !pwd0! is fail^^!
cd /d "!curPath!"
if !breakFlag! equ 1 (
set breakTxt=!fileHash! !fileName! d !pwd0! %1
echo !breakTxt!>breakText.txt
)
)
if "!checkCharFlag!" equ "1" (
cd /d "!curPath!"
cls
echo !beginTime!
echo rar password is !pwd0!^^!
echo !pwd0!>密码.txt
start 密码.txt
echo !pwd0!>>historyPwd.txt
echo %time%
pause
exit
)
)
)
)
exit /b
:diguiAlphat
for /f "skip=10 tokens=2 delims=:" %%a in ('type %temp%\alphat.txt') do (
set cmpFlag=1
if "!cmpBreakFlag!" equ "1" (
if %1 lss !lengths! (
exit /b
)
set cmpFlag=0
if %1 gtr !lengths! (
set cmpFlag=1
) else (
set /a starts=%1-%2+1
call set "j=%%strs:~0,!starts!%%"
set num0=%3%%a
if !num0! equ !j! (
set cmpFlag=1
if %2 equ 1 (
set lastStrFlag=1
)
) else (
set cmpFlag=!lastStrFlag!
)
)
)
if !cmpFlag! equ 1 (
if %2 gtr 1 (
set /a num=%2-1
call:diguiAlphat %1 !num! %3%%a
) else (
cd /d "!rarRoot!"
set pwd2=%3%%a
set checkCharFlag=0
for /f "usebackq tokens=*" %%i in (`7z.exe t !rarFile! -p!pwd2! -bse0^|find "Ok"`) do (
set checkCharFlag=1
)
if "!checkCharFlag!" equ "0" (
echo password !pwd2! is fail^^!
cd /d "!curPath!"
if !breakFlag! equ 1 (
set breakTxt=!fileHash! !fileName! a !pwd2! %1
echo !breakTxt!>breakText.txt
)
)
if "!checkCharFlag!" equ "1" (
cd /d "!curPath!"
cls
echo !beginTime!
echo rar password is !pwd2!^^!
echo !pwd2!>密码.txt
start 密码.txt
echo !pwd2!>>historyPwd.txt
echo %time%
pause
exit
)
)
)
)
exit /b
:checkPwd
for /f "usebackq" %%d in (`7z.exe l -slt !rarFile!^|find "Comment"^|find "%1"`) do (
echo 压缩包注释中包含%1关键词,请尝试用此%1解密
echo.
)
for /f "usebackq" %%m in (`7z.exe l -r -slt !rarFile!^|find "Path"^|find "%1"`) do (
echo 压缩包文件名中包含%1关键词,请尝试用此%1解密
echo.
)
exit /b
:checkPwd1
cd /d "!rarRoot!"
set checkCharFlag=0
for /f "usebackq tokens=*" %%i in (`7z.exe t !rarFile! -p%1 -bse0^|find "Ok"`) do (
set checkCharFlag=1
)
if "!checkCharFlag!" equ "0" (
echo password %1 is fail^^!
)
if "!checkCharFlag!" equ "1" (
cls
echo !beginTime!
echo rar password is %1^^!
cd /d "!curPath!"
echo %1>密码.txt
start 密码.txt
echo %1>>historyPwd.txt
echo %time%
pause
exit
)
goto :eof
)
)
exit /b
:changFormAndCheck
cd /d "!curPath!"
echo A:a>%temp%\alphatComp.txt
echo B:b>>%temp%\alphatComp.txt
echo C:c>>%temp%\alphatComp.txt
echo D:d>>%temp%\alphatComp.txt
echo E:e>>%temp%\alphatComp.txt
echo F:f>>%temp%\alphatComp.txt
echo G:g>>%temp%\alphatComp.txt
echo H:h>>%temp%\alphatComp.txt
echo I:i>>%temp%\alphatComp.txt
echo J:j>>%temp%\alphatComp.txt
echo K:k>>%temp%\alphatComp.txt
echo L:l>>%temp%\alphatComp.txt
echo M:m>>%temp%\alphatComp.txt
echo N:n>>%temp%\alphatComp.txt
echo O:o>>%temp%\alphatComp.txt
echo P:p>>%temp%\alphatComp.txt
echo Q:q>>%temp%\alphatComp.txt
echo R:r>>%temp%\alphatComp.txt
echo S:s>>%temp%\alphatComp.txt
echo T:t>>%temp%\alphatComp.txt
echo U:u>>%temp%\alphatComp.txt
echo V:v>>%temp%\alphatComp.txt
echo W:w>>%temp%\alphatComp.txt
echo X:x>>%temp%\alphatComp.txt
echo Y:y>>%temp%\alphatComp.txt
echo Z:z>>%temp%\alphatComp.txt
echo a:A>>%temp%\alphatComp.txt
echo b:B>>%temp%\alphatComp.txt
echo c:C>>%temp%\alphatComp.txt
echo d:D>>%temp%\alphatComp.txt
echo e:E>>%temp%\alphatComp.txt
echo f:F>>%temp%\alphatComp.txt
echo g:G>>%temp%\alphatComp.txt
echo h:H>>%temp%\alphatComp.txt
echo i:I>>%temp%\alphatComp.txt
echo j:J>>%temp%\alphatComp.txt
echo k:K>>%temp%\alphatComp.txt
echo l:L>>%temp%\alphatComp.txt
echo m:M>>%temp%\alphatComp.txt
echo n:N>>%temp%\alphatComp.txt
echo o:O>>%temp%\alphatComp.txt
echo p:P>>%temp%\alphatComp.txt
echo q:Q>>%temp%\alphatComp.txt
echo r:R>>%temp%\alphatComp.txt
echo s:S>>%temp%\alphatComp.txt
echo t:T>>%temp%\alphatComp.txt
echo u:U>>%temp%\alphatComp.txt
echo v:V>>%temp%\alphatComp.txt
echo w:W>>%temp%\alphatComp.txt
echo x:X>>%temp%\alphatComp.txt
echo y:Y>>%temp%\alphatComp.txt
echo z:Z>>%temp%\alphatComp.txt
set txt=%1
set numFlag=1
set chrs=
set len3=0
set firstTime1=1
set digitFlag=
for /l %%n in (1,1,40) do (
if not "!txt!"=="" (
set chrs=!txt:~0,1!
if "!firstTime1!" equ "1" (
echo !chrs!_%%n>ignoreList.txt
set firstTime1=0
) else (
echo !chrs!_%%n>>ignoreList.txt
)
set skipArr=0,1,2,3,4,5,6,7,8,9
call set "k=%%^skipArr:!chrs!=%%"
if "!k!" equ "!skipArr!" (
set numFlag=0
for /f "tokens=1,2 delims=:" %%s in (%temp%\alphatComp.txt) do (
if "%%s" equ "!chrs!" (
echo %%t_%%n>>ignoreList.txt
)
)
)
set txt=!txt:~1!
set /a len3=!len3!+1
)
)
if "!numFlag!" equ "1" (
goto :eof
) else (
call:digui !len3! 1
)
exit /b
:digui
cd /d "!curPath!"
for /f "usebackq tokens=1,2 delims=_" %%v in (`findstr /r "_%2$" ignoreList.txt`) do (
set pwd1=%3%%v
if "%3" equ "" (
set pwd1=%%v
)
set /a seq=%2+1
if %1 geq %2 (
if %1 equ %2 (
call:checkPwd1 !pwd1!
)
call:digui %1 !seq! !pwd1!
)
)
(全文完)