开发者

Batch Script not working correctly

开发者 https://www.devze.com 2023-03-16 04:20 出处:网络
I created a Batch script to crack a TC volume given a text list of known passwords delimited by a newline. Unfortunately it\'s not working correctly. When it goes down each line, it doesn\'t read spac

I created a Batch script to crack a TC volume given a text list of known passwords delimited by a newline. Unfortunately it's not working correctly. When it goes down each line, it doesn't read spaces. If I have an entry "HelloWorld" it will read "Helloworld", but if the entry is "Hello World", then it will only read "Hello". Code:

@echo off
echo "--- Starting ---"

set drive=V
set tcexe="C:\Program Files\TrueCrypt\TrueCrypt.exe"
set tcvol="C:\Users\Ryan\Desktop\rawr.tar.gz"

:Start
for /f %%i in (p开发者_如何转开发asslist.txt) do call :Crack %%i

:Crack
set pass=%1
echo Trying %pass%...
%tcexe% /q /l %drive% /v %tcvol% /p %pass% /s /e /b
if exist %drive%: goto :End
goto :eof

:End
echo "TC volume cracked!"
echo The password is %pass%
pause

Can someone fix this problem for me? Thanks.


Use

for /f "delims=" %%i in (passlist.txt) do call :Crack "%%i"

and

:Crack
set pass=%1

for /f does tokenizing on the input and by default separates tokens with whitespace. And if you pass those to subroutines you need to quote the argument.

Another option is to not quote in the for line but in set pass="%*". Either way, you need quotes.

0

精彩评论

暂无评论...
验证码 换一张
取 消