d55 Posted August 8, 2008 Share Posted August 8, 2008 (edited) I've encrypted my personal documents and managed to foget the password.I remember most of it but not all. Anyway, I wrote a script to bruteforce itbased on what I remember, the rest is generated. I tested most parts of the script but I'm stuck on one thing.I can't seem to be able to pass an Autoit variable to the command line. Spent all day yesterday on this and just can't get it right.Ignoring and not using Autoit for a second, if at the command line in Win XP I type:C:"\Program Files\TrueCrypt\truecrypt.exe" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /p "(6Dg4)4d2];f32G1'<RfsEqM>/+" /sI can mount the encrypted test volume with no problems. The password being (6Dg4)4d2];f32G1'<RfsEqM>/+.With Autoit, I can mount the above with this line in a script (mounts the test encrypted volume with no problems.): RunWait(@COMSPEC & " /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\TcExp.vob /k D:\Test\key.jpg /lr /a /s /p ""(6Dg4)4d2];f32G1'<RfsEqM>/+""","",@SW_HIDE)The problem with the above is that I'm using a known password. So we need to make one alteration and that is to substitute the $pword variable for it. Since I do not remember the entire thing I have genereated a variable called $pword which is comprised of things I remember and the parts I don't.So when I try to pass the variable to the command line to try the password and mount the volume, I do it like so:RunWait(@COMSPEC & " /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "$pword"","",@SW_HIDE)or like so:RunWait(@COMSPEC & ' /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /p "' & $pword & '" /k D:\Test\key.jpg /lr /a',"",@SW_HIDE)or like so:RunWait(@COMSPEC & ' /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword '"',"",@SW_HIDE)or like so:RunWait(@COMSPEC & ' /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE)It doesn't work. I tried all sorts of alterations to the above, just can't get it to work. Is it not possible to pass variables to the command line with Autoit?This is driving me nuts. I've tested that the proper password has been assigned to $pword, so that is not the problem for sure. Edited August 8, 2008 by d55 Link to comment Share on other sites More sharing options...
d55 Posted August 9, 2008 Author Share Posted August 9, 2008 Sorry there was a type above and it did not let me edit... I've encrypted my personal documents and managed to foget the password. I remember most of it but not all. Anyway, I wrote a script to bruteforce it based on what I remember, the rest is generated. I tested most parts of the script but I'm stuck on one thing. I can't seem to be able to pass an Autoit variable to the command line. Spent all day yesterday on this and just can't get it right. Ignoring and not using Autoit for a second, if at the command line in Win XP I type: C:"\Program Files\TrueCrypt\truecrypt.exe" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /p "(6Dg4)4d2];f32G1'<RfsEqM>/+" /s I can mount the encrypted test volume with no problems. The password being (6Dg4)4d2];f32G1'<RfsEqM>/+. With Autoit, I can mount the above with this line in a script (mounts the test encrypted volume with no problems.): RunWait(@COMSPEC & " /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p ""(6Dg4)4d2];f32G1'<RfsEqM>/+""","",@SW_HIDE) The problem with the above is that I'm using a known password. So we need to make one alteration and that is to substitute the $pword variable for it. Since I do not remember the entire thing I have genereated a variable called $pword which is comprised of things I remember and the parts I don't. So when I try to pass the variable to the command line to try the password and mount the volume, I do it like so: RunWait(@COMSPEC & " /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "$pword"","",@SW_HIDE) or like so: RunWait(@COMSPEC & ' /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /p "' & $pword & '" /k D:\Test\key.jpg /lr /a',"",@SW_HIDE) or like so: RunWait(@COMSPEC & ' /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword '"',"",@SW_HIDE) or like so: RunWait(@COMSPEC & ' /c C:""\Program Files\TrueCrypt\truecrypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE) It doesn't work. I tried all sorts of alterations to the above, just can't get it to work. Is it not possible to pass variables to the command line with Autoit? This is driving me nuts. I've tested that the proper password has been assigned to $pword, so that is not the problem for sure. Link to comment Share on other sites More sharing options...
Varian Posted August 9, 2008 Share Posted August 9, 2008 Do you have do pass it to Comspec? I was able to get it to work by running it without using comspec. I just extracted TrueCrypt to my desktop, so here is my code: Run(@DesktopDir & '\TrueCrypt\TrueCrypt.exe /v "' & @DesktopDir & '\TrueCrypt\TrueCrypt.volume" /b /p "password" /k "' & @DesktopDir & '\TrueCrypt\keyfile" /a /lx', '', @SW_HIDE) When I tried it using comspec, it did not pass the password either(weird) You might try this code: Run(@ProgramFilesDir & '\TrueCrypt\truecrypt.exe /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE) I changed RunWait to Run because the scipt halts until you manually exit out of TrueCrypt..If you want to loop through, you could maybe sleep and wait until drive R exists, or wait for "password incorrect" dialog box opens up. Cool Software, BTW. Link to comment Share on other sites More sharing options...
Varian Posted August 9, 2008 Share Posted August 9, 2008 I was able to make it run with comspec using the 8.3 file path rather than the long name file path... In other words, rather than using "C:\Program Files\TrueCrypt\truecrypt.exe" I used C:\progra~1\TRUECR~1\TRUECR~1.EXE so I did not have to use quotes around it and it worked! I knew something was weird because I had to use 2 double quotes in front of the C:\program files even though i used single quotes to wrap the command Instead of Run(@Comspec & ' /c "C:\Program Files\TrueScrypt\TrueScypt.exe" (rest of switches)' I had to use Run(@Comspec & ' /c ""C:\Program Files\TrueScrypt\TrueScypt.exe" (rest of switches)' I never had to do this with other executables Still weird, though. Hope this helps. Link to comment Share on other sites More sharing options...
d55 Posted August 9, 2008 Author Share Posted August 9, 2008 Thanks! I tried both Run and RunWait... Here is my experience. Does not work. RunWait(@Comspec & ' /c ""C:\Program Files\TrueScrypt\TrueScypt.exe" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE) Does not work. RunWait(@Comspec & ' /c ""C:\Program Files\TrueScrypt\TrueScypt.exe"" /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE) Works! Run(@ProgramFilesDir & '\TrueCrypt\truecrypt.exe /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE) Works! RunWait(@Comspec & ' /c C:\progra~1\TRUECR~1\TRUECR~1.EXE /v D:\Test\Experiment.vob /k D:\Test\key.jpg /lr /a /s /p "' & $pword & '"',"",@SW_HIDE) Strange, yes. Thanks for your help!! I really appreciate it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now