I am working on a brute force attack like software (a .bat file), which will try to extract a file, with some predefined passwords. My algorithm is somehow like this: -
"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
like this. Everything is working according to my expectation with a problem in 10% of the cases.
In normal case i.e, for manual extraction (not with my software) I found: There are certain rar files which starts extracting even with a wrong password and when the extraction is about to complete, it shows an error message "Corrupted file or wrong password" . My software in such cases, faces a great problem => It extracts the same file a number of times because ERRORLEVEL is 0 (until the extraction is about to finish). Is there any way to modify such rar files so that,it will not start extracting with wrong passwords. Or, any way to detect the error code at the beginning of extraction (Not near the end of extraction).