Jump to content
Sign in to follow this  
JonathanChan

What I Do Wrong? Memory Leak

Recommended Posts

JonathanChan

Hello,

I have this script that loops millions of times... It is fine for about 10,000 iterations, but the memory is steadily eaten away... I think I have to unset a variable or something to free up the memory, but I can't figure out where my memory is being eaten up at... Please help.. Thanks...

#include <String.au3>
#include <array.au3>

$file=FileOpen("D:\home\jonathan\programming\SecurityTools\Brute Force\dictionary\masterPERMUTATIONS.txt", 0)
$count=FileRead("md5tmp.txt")
FileReadLine($file,$count)
while 1
    $pw=_URLEncode(FileReadLine($file))
    
    $std=Run("lynx.exe -dump http://us.md5.crysm.net/add?text=" & $pw,"",@SW_HIDE,2)
    sleep(1000)
    $line=StdoutRead($std)
    $array=StringSplit($line,@crlf)
    TrayTip($pw,$array[2],2)
    sleep(1000)
    $count=$count+1
    if mod($count,25) = 0 Then
        $tmpFile=fileopen("md5tmp.txt",2)
        FileWrite($tmpFile,$count)
        FileClose($tmpFile)
    EndIf
    
Wend

Func _URLEncode($toEncode, $encodeType = 2)
Local $strHex = "", $iDec
Local $aryChar = StringSplit($toEncode, "")
If $encodeType = 1 Then;;Encode EVERYTHING
  For $i = 1 To $aryChar[0]
   $strHex = $strHex & "%" & Hex(Asc($aryChar[$i]), 2)
  Next
  Return $strHex
ElseIf $encodeType = 0 Then;;Practical Encoding
  For $i = 1 To $aryChar[0]
   $iDec = Asc($aryChar[$i])
   if $iDec <= 32 Or $iDec = 37 Then
    $strHex = $strHex & "%" & Hex($iDec, 2)
   Else
    $strHex = $strHex & $aryChar[$i]
   EndIf
  Next
  Return $strHex
ElseIf $encodeType = 2 Then;;RFC 1738 Encoding
  For $i = 1 To $aryChar[0]
   If Not StringInStr("$-_.+!*'(),;/?:@=&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", $aryChar[$i]) Then
    $strHex = $strHex & "%" & Hex(Asc($aryChar[$i]), 2)
   Else
    $strHex = $strHex & $aryChar[$i]
   EndIf
  Next
  Return $strHex
EndIf
EndFunc

Share this post


Link to post
Share on other sites
The Kandie Man

Nah, you don't want to crack passwords. You really don't. Even if you really really really did want to(because you forgot your password), you wouldn't use AutoIt. It is much too slow for something like that.

- The Kandie Man ;-)

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites
JonathanChan

I'm not cracking passwords... I'm adding a dictionary table to a md5 hash table... http://us.md5.crysm.net/about If you check that site, it's not hacking... it's purely a scholarly study... Any help appreciated...

Edited by JonathanChan

Share this post


Link to post
Share on other sites
herewasplato

I'm not cracking passwords... I'm adding a dictionary table to a md5 hash table... http://us.md5.crysm.net/about If you check that site, it's not hacking... it's purely a scholarly study... Any help appreciated...

I read about that site when I saw your OP. This part made me laugh:

"...throwing away New Zealand's sovereignty..."

rantThis exercise in computer science is probably illegal under the DMCA. Our remote tropical location of New Zealand should make things more interesting should lawyers come in pursuit of us. Thanks to Comrade Helen Clark throwing away New Zealand's sovereignty, we'll probably be extradited and sued all the same.

Hooray for stupid laws and the loss of sovereignty!

As for what may be wrong with your script, nothing that a trip thru the help file could not solve. I suggest that you visit the help file for each line of code that you wrote... not the UDF.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
Omegis

your memory leak is probably because you are using the Filereadline function,

remove that function, insted: read 1000 lines do proccessing read next 1000 lines

while you read use openfile and closefile function.

it will be even better to work on a DB like SQLite (implemented in autoit)

Share this post


Link to post
Share on other sites
Fzz

Your memory leak is probably because there is actually a memory leak in the FileReadLine function when using the unicode version of AutoIt against a non unicode version of data. Compiling your scirpt using the "Comiple for ANSI" option checked may help your problem. It did for me.

Memory Leak with FileReadLine

Share this post


Link to post
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
Sign in to follow this  

×