Jump to content

Need help scripting


Recommended Posts

I'm very new to the whole scripting process, so I need a bit of help working this one out.

I'm trying to create a script that is basically a guess and check method. I suppose you could call it a dictionary attack of sorts, but not for anything malicious. I forgot my password to a TrueCrypt container I had, but it's a short password, so I figured I could either brute force or dictionary attack it.

If there's a script out there already to do this, that would work too, but I could not find one with a search.

I have an idea as to how it might work. I just don't know how to script it. But, here goes.

TrueCrypt opens a window that has title "Enter password for C:\EncryptedFile"

So, I would use

WinWaitActive("Enter password for C:\EncryptedFile")

This is where I run into problems. I'm thinking that I should use If's. I'm not sure if that's what they're called, but that's what they basically do. If a window pops up saying "Incorrect password" then have it try the next password on the list. If no window pops up, then shut the script off.

Also, how would I script it to do the brute force? I've tried this code that someone else wrote:

dim $one, $two, $three, $four, $five, $six, $seven, $eight, $pw
dim $Array[94]
$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]=">"
$Array[92]="/"
$Array[93]="?"

;Start brute Force
For $one = 0 to 93
$pw = $Array[$one]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next

for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next

for $three = 0 to 93
for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
$pw &= $Array[$three]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next
Next

for $four = 0 to 93
for $three = 0 to 93
for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
$pw &= $Array[$three]
$pw &= $Array[$four]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next    
Next
Next


for $five = 0 to 93
for $four = 0 to 93
for $three = 0 to 93
for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
$pw &= $Array[$three]
$pw &= $Array[$four]
$pw &= $Array[$five]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next
Next    
Next
Next

FOR $six = 0 to 93
for $five = 0 to 93
for $four = 0 to 93
for $three = 0 to 93
for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
$pw &= $Array[$three]
$pw &= $Array[$four]
$pw &= $Array[$five]
$pw &= $Array[$six]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next
Next
Next    
Next
Next


for $seven = 0 to 93
FOR $six = 0 to 93
for $five = 0 to 93
for $four = 0 to 93
for $three = 0 to 93
for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
$pw &= $Array[$three]
$pw &= $Array[$four]
$pw &= $Array[$five]
$pw &= $Array[$six]
$pw &= $Array[$seven]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next
Next
Next
Next    
Next
Next

for $eight = 0 to 93
for $seven = 0 to 93
FOR $six = 0 to 93
for $five = 0 to 93
for $four = 0 to 93
for $three = 0 to 93
for $two = 0 to 93
for $one = 0 to 93
$pw = $Array[$one]
$pw &= $Array[$two]
$pw &= $Array[$three]
$pw &= $Array[$four]
$pw &= $Array[$five]
$pw &= $Array[$six]
$pw &= $Array[$seven]
$pw &= $Array[$eight]
Run(@COMSPEC & " /c " & 'C:\TrueCrypt.exe /q background /s /p "' & $pw & '" /e /m ro /m rm /v "C:\EncryptedFile"' )
Next
Next
Next
Next
Next
Next    
Next
Next

But this never worked for me. I only got command prompts that slowed my computer down.

Is there a way that I can get it to do one letter, entire alphabet, then two letters (aa, ab, ac, ad, etc. through zz) and so-on?

I'm not sure if I made any sense, but I'd appreciate any help at all.

Edited by BillyBuddy
Link to comment
Share on other sites

you make sense.. but the implications of what could happen to this script after your done, well its hacking... and i will say this..

IF THEN

ENDIF

Chr (Random ( Asc (a), Asc (z)))

Helpfile helps alot

Link to comment
Share on other sites

the helpfile is your friend here!

welcome to the forums, and here is probably what you want to look at:

firstly, run the program, don't rely on yourself (DO NOT take me literally)

so

Do

1) run

2) winwaitactive (EnterPass)

3) send or control send ($Pass)

4) If Winactive (Wrong pass) Then

Winclose (Wrong Pass)

$Pass += 1 ; Password moves on to the next.

EndIf

Until Winactive (right pass)

MsgBox(48, "Congrats", "Right password is :" & $Pass)

this is a very brief outline, and doesn't work. but you will find all the functions in the helpfile.

isn't there a sort of masterpass feature for truecrypt.

as said by cody, if this is hacking, then its not wanted on the forum....

Have Fun!!

the do tag means it will keep repeating until you get the right pass.

Link to comment
Share on other sites

also from your script upthere, why dont you make your password something easy to remember.. like based on something you did that you and you alone will remember.. not like this THIs is way to complicated

$%*(@!adghanjtaga7)#^%/-*/*56943218tajta8^%%%

BTW just an example of buttonmashing :D

Link to comment
Share on other sites

the helpfile is your friend here!

welcome to the forums, and here is probably what you want to look at:

firstly, run the program, don't rely on yourself (DO NOT take me literally)

so

Do

1) run

2) winwaitactive (EnterPass)

3) send or control send ($Pass)

4) If Winactive (Wrong pass) Then

Winclose (Wrong Pass)

$Pass += 1 ; Password moves on to the next.

EndIf

Until Winactive (right pass)

MsgBox(48, "Congrats", "Right password is :" & $Pass)

this is a very brief outline, and doesn't work. but you will find all the functions in the helpfile.

isn't there a sort of masterpass feature for truecrypt.

as said by cody, if this is hacking, then its not wanted on the forum....

Have Fun!!

the do tag means it will keep repeating until you get the right pass.

I see where you're coming from on hacking. I hope I'm not infringing on the rules =/ I just need this darn file open.

TrueCrypt doesn't really have a backdoor, or a universal masterpass. That's what makes it so secure (And frustrating when you forget your password)

But, thank you for your help :D I'll try to look through the help file more thoroughly

Link to comment
Share on other sites

Okay, so I need a bit of help again. I formatted my code using the Do...Until statement like said. This is what I have so far:

Do
    WinWaitActive("Enter password for C:\EncryptedFile")
    Send("*********")
    Send("{ENTER}")
    If WinWaitActive("TrueCrypt", "or not a") Then
        Send("{ENTER}")
        ************
    EndIf
Until WinWaitActive("TrueCrypt", "&Create Volume")

Now the problems are the **********'s. I still don't understand how to change the value of the password each time. If it were numbers, it would be easy. But, with letters, I'm not sure how to go

a

b

c

d

...

z

aa

ab

ac

..

az

ba

bb

bc

...

bz

ca

cb

cc

...

Etc. all the way through say zzzzz

I checked this script out in a help file:

$i = 0 
Do 
    MsgBox(0, "Value of $i is:", $i) 
    $i = $i + 1 
Until $i = 10

It went until the value was 10. How would I apply this script to mine?

The first ********** would be the password that is sent to the box, and then changed each time it fails. Any ideas?

Link to comment
Share on other sites

You said it was a word and you were dictionary hacking, just use filereadline on a dictoinary...

#include ("File.au3")
$Dictionary = @Scriptdir & "\dictionary.txt"
$i = 1
Do
MsgBox (48, "Test", filereadline ($Dictionary, $i))
$i += 1
Until $i = _FileCountlines ($Dictionary) +1

lol, first words that came to my head.

even better:

$Dictionary = @Scriptdir & "\dictionary.txt"
If StringInStr(FileRead($Dictionary), @LF) Then
    $FileLines = StringSplit(StringStripCR(FileRead($Dictionary)), @LF)
Else
    $FileLines = StringSplit(FileRead($Dictionary), @CR)
EndIf
$i = 1
Do
MsgBox (48, "Test", $FileLines[$i])
$i += 1
Until $i = $FileLines[0] + 1

this is a pretty neat little code actually!

Edited by mdiesel
Link to comment
Share on other sites

You said it was a word and you were dictionary hacking, just use filereadline on a dictoinary...

#include ("File.au3")
$Dictionary = @Scriptdir & "\dictionary.txt"
$i = 1
Do
MsgBox (48, "Test", filereadline ($Dictionary, $i))
$i += 1
Until $i = _FileCountlines ($Dictionary) +1

lol, first words that came to my head.

even better:

$Dictionary = @Scriptdir & "\dictionary.txt"
If StringInStr(FileRead($Dictionary), @LF) Then
    $FileLines = StringSplit(StringStripCR(FileRead($Dictionary)), @LF)
Else
    $FileLines = StringSplit(FileRead($Dictionary), @CR)
EndIf
$i = 1
Do
MsgBox (48, "Test", $FileLines[$i])
$i += 1
Until $i = $FileLines[0] + 1

this is a pretty neat little code actually!

No, not necessarily a word. I was wrong when I said a dictionary attack :$ It really would be a brute force. But, how would I even incorporate that into my existing script? Or, would this become the whole script? I'm quite lost when it comes to coding...
Link to comment
Share on other sites

haha... im still not %100 happy about this thread..... even if its personal use only..ITS still HACKING...

:D

Link to comment
Share on other sites

haha... im still not %100 happy about this thread..... even if its personal use only..ITS still HACKING...

:D

I know =/ But, I'd prefer to ask here than go to a site that DOES deal with hacking purposely for nonpersonal use. I don't mean to break morals of this site, but I just need to get this done =/

Link to comment
Share on other sites

hmm i worked out a little script there is wrigting 4 letters (a,b,c,d) and its 4 letters long (sorry for bad english :D)

$1=1;a
$2=1;a
$3=1;a
$4=1;a
while 1
sleep (100)



if $1=4 then 
$1=1
$2=$2+1
endif
if $1=1 then send ("a")
if $1=2 then send ("b")
if $1=3 then send ("c")
if $1=4 then send ("d")

;_______
if $2=4 then
$3=$3+1
$2=1
endif
if $2=1 then send ("a")
if $2=2 then send ("b")
if $2=3 then send ("c")
if $2=4 then send ("d")


;_______
if $3=4 then 
$4=$4+1                           
$3=1
endif
if $3=1 then send ("a")
if $3=2 then send ("b")
if $3=3 then send ("c")
if $3=4 then send ("d")

;_______
if $4=1 then send ("a")
if $4=2 then send ("b")
if $4=3 then send ("c")
if $4=4 then send ("d")
if $4=4 then 
    msgbox (0,"done","done")
    Exit
    endif
$1=$1+1
send ("{space}")
wend

hmm should work :D

the variable ($1,$2,$3,$4) is how long the code is (if it is ex. 8 long then you should make 8 variables) and the 1,2,3,4 is how many letters it should use :o

Edited by TheOnlyOne
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...