测试环境:WIN10
使用方法:
1.文本编辑器保存为ANSI编码,文件名随意,文件类型bat
2.双击运行,输入数字密码位数,输入WINRAR主目录和解密文件路径回车
3.程序会根据位数开启多个进程,计算完毕会只保留结果窗口,其他窗口关闭
@echo off
setlocal enabledelayedexpansion
echo WINRAR数字密码解密器,会生成多个窗口跑密码,勿关
if "%1" equ "" (
set /p numDigit=请输入密码最大位数:
set /p rarRoot=请输入WINRAR主目录,如C:\Program Files\WinRAR:
set /p rarFile=请输入数字密码压缩文件包路径,如C:\test.rar:
rem 数字位数
rem set numDigit=10
rem 线程数
set /a threadNum=0+numDigit
for /l %%x in (1,1,!threadNum!) do (
copy /b /y %0 %temp%\thd%%x.bat
start "rarNumPwdThread%%x" /min %temp%\thd%%x.bat %%x !threadNum!
)
) else (
set idx=%1
set maxThd=%2
call:threadMain
)
:threadMain
cd /d "!rarRoot!"
set begin=0
set end=1
for /l %%x in (1,1,!idx!) do (
set /a end=!end!*10
)
if not "!idx!"=="1" (
set /a begin=!end!/10
)
set /a totalnum=!end!-!begin!+1
for /l %%a in (!begin!,1,!end!) do (
rar x -mt50 -o+ -r- -p%%a -inul -ilog%temp%\rarlog!idx!.txt "!rarFile!"
set checkCharFlag=1
for /f "usebackq tokens=3 delims=:" %%b in (`find /c "错误" %temp%\rarlog!idx!.txt`) do (
set checkChar=%%b
set checkChar=!checkChar: =!
if not "!checkChar!"=="0" (
rem echo password %%a is wrong^^!
set checkCharFlag=0
)
)
if "!checkCharFlag!" equ "1" (
cls
echo rar password is %%a^^!
for /l %%c in (1,1,!maxThd!) do (
if not "!idx!"=="%%c" (
taskkill /f /fi "windowtitle eq rarNumPwdThread%%c*" /fi "status eq running">nul
)
)
pause
exit
)
del /q %temp%\rarlog!idx!.txt
set /a num1=%%a-!begin!+1
set /a num1=!num1!*100
set /a num2=!end!-!begin!+1
set /a progressnum=num1/num2
cls
echo !begin!~!end!范围数字测试已完成!progressnum!%%
)
exit
(全文完)