Brute-Force Truecrypt Password

Did you forget your Truecrypt password?

Not to worry, using simple search in Google I found a script in this site, and I adapt it for my needs, I post it  here because it could be helpful to other.

To succesful run the script you will required to install AutoITscript, that is AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

The script will use all the character or words that in the variable $Array, to run on all the possibilities and combination of any order, from 2 combination to 7 combination and try to open the container. The script will run until it will find a match or it will exhaust any of your given possibilities.

Note:

  • $truecryptPath is the path of your TrueCrypt program
  • $containerPath is the path to the container that you wont to open
  • If the script find the right password it automatically mount the container to one of the free drive letters and open explorer to it.
  • The path to the TrueCrypt program and to your container MUST be in DOS-8 characters format, to get it you need to use “dir /x” and CMD.
  • you also can save time by eliminate character that you absolutely sure that you didn’t use in your password oryou can change every place in the array to possible combination of your passwordfor example: if I have same patterns for my password and I am using only combination of it
    • date of my child = 1308200
    • ID number = 123456789
    • name of the neighbor = moshe
    • family name = ofnick

Add  those to the $Array  and run all combination of your favorites password to save you time by running the script only on your your combination password

AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

So here is the script:

dim $one, $two, $three, $four, $five, $six, $seven, $eight, $pw, $pp, $count, $truecryptPath, $containerPath
 $truecryptPath = "C:PROGRA~1TrueCryptTrueCrypt.exe /q background /s "
 $containerPath = "d:cscs2.tre"
 dim $numberOfCharacters = 92
 dim $Array[$numberOfCharacters+1]
 $Array[0]="a"
 $Array[1]="b"
 $Array[2]="c"
 $Array[3]="d"
 $Array[4]="e"
 $Array[5]="f"
 $Array[6]="g"
 $Array[7]="h"
 $Array[8]="i"
 $Array[9]="j"
 $Array[10]="k"
 $Array[11]="l"
 $Array[12]="m"
 $Array[13]="n"
 $Array[14]="o"
 $Array[15]="p"
 $Array[16]="q"
 $Array[17]="r"
 $Array[18]="s"
 $Array[19]="t"
 $Array[20]="u"
 $Array[21]="v"
 $Array[22]="w"
 $Array[23]="x"
 $Array[24]="y"
 $Array[25]="z"
 $Array[26]="A"
 $Array[27]="B"
 $Array[28]="C"
 $Array[29]="D"
 $Array[30]="E"
 $Array[31]="F"
 $Array[32]="G"
 $Array[33]="H"
 $Array[34]="I"
 $Array[35]="J"
 $Array[36]="K"
 $Array[37]="L"
 $Array[38]="M"
 $Array[39]="N"
 $Array[40]="O"
 $Array[41]="P"
 $Array[42]="Q"
 $Array[43]="R"
 $Array[44]="S"
 $Array[45]="T"
 $Array[46]="U"
 $Array[47]="V"
 $Array[48]="W"
 $Array[49]="X"
 $Array[50]="Y"
 $Array[51]="Z"
 $Array[52]="!"
 $Array[53]="@"
 $Array[54]="#"
 $Array[55]="$"
 $Array[56]="%"
 $Array[57]="^"
 $Array[58]="&"
 $Array[59]="*"
 $Array[60]="("
 $Array[61]=")"
 $Array[62]="_"
 $Array[63]="+"
 $Array[64]="~"
 $Array[65]="`"
 $Array[66]="1"
 $Array[67]="2"
 $Array[68]="3"
 $Array[69]="4"
 $Array[70]="5"
 $Array[71]="6"
 $Array[72]="7"
 $Array[73]="8"
 $Array[74]="9"
 $Array[75]="0"
 $Array[76]="-"
 $Array[77]="="
 $Array[78]="["
 $Array[79]="]"
 $Array[80]=""
 $Array[81]="{"
 $Array[82]="}"
 $Array[83]="|"
 $Array[84]=";"
 $Array[85]=":"
 $Array[86]="'"
 $Array[87]=""""
 $Array[88]=","
 $Array[89]="."
 $Array[90]="/"
 $Array[91]="?"
$count = 0
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 Wend
 EndIf
Next
 Next
While ProcessExists($pp)>0
 Wend
$count = 0
 for $three = 0 to $numberOfCharacters
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $pw &= $Array[$three]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 $count = 0
 Wend
 EndIf
Next
 Next
 Next
While ProcessExists($pp)>0
 Wend
$count = 0
 for $four = 0 to $numberOfCharacters
 for $three = 0 to $numberOfCharacters
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $pw &= $Array[$three]
 $pw &= $Array[$four]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 $count = 0
 Wend
 EndIf
Next
 Next
 Next
 Next
While ProcessExists($pp)>0
 Wend
$count = 0
 for $five = 0 to $numberOfCharacters
 for $four = 0 to $numberOfCharacters
 for $three = 0 to $numberOfCharacters
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $pw &= $Array[$three]
 $pw &= $Array[$four]
 $pw &= $Array[$five]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 Wend
 $count = 0
 EndIf
Next
 Next
 Next
 Next
 Next
While ProcessExists($pp)>0
 Wend
$count = 0
 FOR $six = 0 to $numberOfCharacters
 for $five = 0 to $numberOfCharacters
 for $four = 0 to $numberOfCharacters
 for $three = 0 to $numberOfCharacters
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $pw &= $Array[$three]
 $pw &= $Array[$four]
 $pw &= $Array[$five]
 $pw &= $Array[$six]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 Wend
 $count = 0
 EndIf
Next
 Next
 Next
 Next
 Next
 Next
While ProcessExists($pp)>0
 Wend
$count = 0
 for $seven = 0 to $numberOfCharacters
 FOR $six = 0 to $numberOfCharacters
 for $five = 0 to $numberOfCharacters
 for $four = 0 to $numberOfCharacters
 for $three = 0 to $numberOfCharacters
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $pw &= $Array[$three]
 $pw &= $Array[$four]
 $pw &= $Array[$five]
 $pw &= $Array[$six]
 $pw &= $Array[$seven]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 Wend
 $count = 0
 EndIf
Next
 Next
 Next
 Next
 Next
 Next
 Next
While ProcessExists($pp)>0
 Wend
for $eight = 0 to $numberOfCharacters
 for $seven = 0 to $numberOfCharacters
 FOR $six = 0 to $numberOfCharacters
 for $five = 0 to $numberOfCharacters
 for $four = 0 to $numberOfCharacters
 for $three = 0 to $numberOfCharacters
 for $two = 0 to $numberOfCharacters
 for $one = 0 to $numberOfCharacters
 $pw = $Array[$one]
 $pw &= $Array[$two]
 $pw &= $Array[$three]
 $pw &= $Array[$four]
 $pw &= $Array[$five]
 $pw &= $Array[$six]
 $pw &= $Array[$seven]
 $pw &= $Array[$eight]
 $count = $count+1
 $pp  = Run(@COMSPEC & " /c " & $truecryptPath & " /p "& $pw & " /e /m ro /m rm /v " &$containerPath )
 ProcessSetPriority($pp, 0)
if $count>25 then
 While ProcessExists($pp)>0
 Wend
 $count = 0
 EndIf
Next
 Next
 Next
 Next
 Next
 Next
 Next
 Next


	

10 thoughts on “Brute-Force Truecrypt Password”

  1. ok m a total noob in these matters,.. i downloaded the program, copied the script in script editor n coreected the address of my truecrypt file. but it keeps on showing path not corret. i wud be pleased if u would help me out. 🙂 thnx neways.

    1. No Problem, and thanks on paying attantion to small problem there.. I fixed the code, aberantly its was a mix with the ” and ‘ character…

      the path should be like this:
      $truecryptPath = “C:PROGRA~2TrueCryptTrueCrypt.exe /q background /s /p ”

      Let me know if its solve your problem.

  2. what happens exactly when “$count>25”?
    it goes on to the next part of the program? doesn’t that mean that after you tried a-z he doesn’t go on with the other characters? or am I missing something?

    1. The program execute 25 instances of TrueCrypt at parallel, the reason for 25 is that I didn’t want to overload the system. Then when “$count>25″ is reach the program will wait until one of the 25 TrueCrypt finish, and then run another one.

      1. i always get the error: invalid drive letter. how do i force a drive letter, since tc obviously has a problem with the script selecting the next free one?

        1. “c:Program FilesTrueCryptTrueCrypt.exe /l” or “c:Program FilesTrueCryptTrueCrypt.exe /letter”
          will force TrueCrypt to mount on specific letter

  3. I’m not very good at Basic like syntax. What would be the best way to produce array with some of the characters predefined?

    For example if one knows beginning of password then script would only need to permute last few characters from the predefined character pool (useful for longer password with known characters at the beginning).

    Any ideas?

    1. Because its a AutoIt script it you can use the char array as a string array.
      For Example:
      dim $numberOfCharacters = 3
      dim $Array[$numberOfCharacters+1]
      $Array[0]=”Pass”
      $Array[1]=”Word”
      $Array[2]=”Test”

      Now all you need is to reduce the loops

      Good Luck!

Leave a Reply to Hananel Hazan Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.