Jump to content

What I Do Wrong? Memory Leak


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • 3 weeks later...

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...