Jump to content
Sign in to follow this  
obscurant1st

script to find md5

Recommended Posts

obscurant1st

I have coded a script to find n display md5's of several files not more than 50 at a time with the help of another opensource utility.

here there are two problms i'm facing in this.

here is the code for my script.

#NoTrayIcon
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=md5calc.exe
#AutoIt3Wrapper_Res_Comment=obscurant1st.biz
#AutoIt3Wrapper_Res_Description=Made by obscurant1st
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=obscurant1st
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
;#AutoIt3Wrapper_icon=icons\icontexto-webdev-emoticon-smile-128x128.ico

;Copy this exe file to send folder and then you can use this 
;small utility to calculate md5s of appr. not less than 50 files.

#include <Array.au3>
#include <GUIConstants.au3>
#Include <GuiEdit.au3>
#include <file.au3> 
#include <ClipBoard.au3>
#include <INet.au3>
#include <String.au3>

Dim $hPID
Dim $k=0
Dim $md5list[50]
Func FindfileName($tempfile)
    local $tempstr , $tempnum
    Local $str
    Local $k
    $tempfile = StringTrimLeft ( $tempfile , 34 )
    $str = StringSplit($tempfile ,"\")
    $tempstr = ""
    For $k = 1 to UBound($str)-2 Step +1
        $tempstr = $tempstr & $str[$k] & "\"
    Next
    Return $tempstr
EndFunc

    
DirCreate(@ProgramFilesDir & "\" & "md5chk")
FileInstall("C:\Users\obscurant1st\Desktop\Md5.exe", @ProgramFilesDir & "\" & "md5chk" & "\")
IF ubound($CmdLine)-1 > 0 Then
    $FolderName=$CmdLine[1]
    For $i = 1 to ubound($CmdLine) -1 
        $hPID = Run("md5.exe " & '"' & $CmdLine[$i] & '"' , @ProgramFilesDir & "\" & "md5chk" & "\", @SW_HIDE , 2)
        ProcessWaitClose($hPID)
        $sLine = StdoutRead($hPID)
        $md5string = FindfileName($sLine)
        $md5list[$i] = StringReplace($sLine , $md5string , "")
        If @error = 1 Then
            ExitLoop
        EndIf
    Next
EndIf





#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Md5 Calculator", 421, 236, 321, 174)
GUISetBkColor(0xA6CAF0)
$MD5s = GUICtrlCreateEdit("", 16, 16, 385, 201)
For $m = 1 to ubound($CmdLine) -1
    if $m=1 Then
        GUICtrlSetData(-1,$md5list[$m])
    Else
        _GUICtrlEdit_AppendText($MD5s,@CRLF)
        _GUICtrlEdit_AppendText($MD5s,$md5list[$m])
    EndIf
Next
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

1 problem is

whatever i do the exe file can only be run if the script is compiled at the same place. ie i mean if i try to run the exe file in another system it simply wont work.

i think its the problem with file install function coz if i remove that line and do those things manually it works with out any problems.Can any body help me on this???

2nd problem is

is there any method by which i can use this script for finding the md5s of more than 60 files.???

I have attached the exe for findin md5 which i'm using in this script with this msg.

Thank you.

Md5.exe

Share this post


Link to post
Share on other sites
rajeshontheweb
obscurant1st

yeah thats a trouble

you will have to use a code to find out if the file exists in the PC

You can check a primitive work done i had done http://www.autoitscript.com/forum/index.php?showtopic=91105

oh thx mate..

i dint know that there is a md5.au3 file..

thank you for this..

Anyway i'm also doin this for malware analysis.. :P

Share this post


Link to post
Share on other sites
ChrisL

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.