我正在研究一种类似于软件( .bat文件)的暴力破解攻击,它会尝试提取一个带有一些预定义密码的文件。我的算法是这样的:
"C:\Program Files\WinRAR\WinRAR.exe" x -inul -ppassword1 "path to my rar file"
if %ERRORLEVEL% GEQ 1 GOTO try2
GOTO exit
:try2
"C:\Program Files\WinRAR\WinRAR.exe" x -inul -ppassword2 "path to my rar file"
if %ERRORLEVEL% GEQ 1 GOTO try3
GOTO exit
:try3
"C:\Program Files\WinRAR\WinRAR.exe" x -inul -ppassword3 "path to my rar file"
if %ERRORLEVEL% GEQ 1 GOTO try4
GOTO exit
就像这样。在10%的情况下,一切都按照我的预期工作。
在正常情况下,即,对于手动解压(不是使用我的软件),我发现:有某些rar文件即使使用错误的密码也会开始解压,当解压即将完成时,它会显示错误消息“损坏的文件或错误的密码”。在这种情况下,我的软件面临着一个很大的问题,因为ERRORLEVEL是0(直到提取即将完成),所以它会多次提取相同的文件。有没有办法修改这样的rar文件,使它不会开始提取错误的密码。或者,任何在提取开始时(不是在提取结束时)检测错误代码的方法。
发布于 2014-01-15 01:51:40
我不能帮助您解决WinRAR问题,但我可以帮助您解决批处理方法:
@echo off
setlocal EnableDelayedExpansion
for %%p in (password1 password2 ... passwordEtc
passwordN passwordM) do (
"C:\Program Files\WinRAR\WinRAR.exe" x -inul -p%%p "path to my rar file"
if !ERRORLEVEL! EQU 0 GOTO exit
)
echo Unable to extract after tried all paswords...
https://stackoverflow.com/questions/21114767
复制相似问题