Sign in to follow this  
Followers 0
iamtheky

SHA256 Hunter - In Progress

1 post in this topic

This is functional, but will be getting work done to it all next week.  Anybody who wants to participate in improvements is welcome, I would be much obliged if you would do so with code rather than conjecture.

#include <array.au3>
#include <File.au3>
#include <Crypt.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
 #include <Security.au3>

Global Const $CALG_SHA_256 = 0x0000800c

$hGUI = GUICreate("SHA256 Hunter" , 420 , 240) ; will create a dialog box that when displayed is centered

Local $hCompName = GUICtrlCreateInput("     Computer Name or IP Address", 1, 5, 190, 20)


    Local $idRadio1 = GUICtrlCreateRadio("File", 10, 45, 100, 20)

    $hFilename = GUICtrlCreateInput("filename (or partial)" , 10 , 65 , 190 , 20)
    $hPath = GUICtrlCreateInput("\c$\Users\" & @UserName & "\Desktop" , 10 , 90 , 190 , 20)
    $hSHA2 = GUICtrlCreateInput("SHA256" , 10 , 115 , 190 , 20)

    Local $idButtonGO = GUICtrlCreateButton("GO", 275, 202, 60, 20)

    GUISetState(@SW_SHOW)


    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()
        Select
            Case $idMsg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $idMsg = $idButtonGO AND $idRadio1 And BitAND(GUICtrlRead($idRadio1), $GUI_CHECKED) = $GUI_CHECKED
                $inputfile = GUICtrlRead($hFilename)
                $inputpath = GUICtrlRead($hPath)
                $inputSHA2 = GUICtrlRead($hSHA2)
                $inputCompName = GUICtrlRead($hCompName)
                    If $inputCompName = "     Computer Name or IP Address" OR $inputCompName = "" Then $inputCompName = "localhost"

                If asc($inputpath) = 0 OR $inputpath = "Path" Then $inputpath = ""
                If asc($inputfile) = 0 OR $inputfile = "filename (or partial)" Then $inputfile = ""
                If asc($inputSHA2) = 0 OR $inputSHA2 = "SHA256" Then $inputSHA2 = ""
                _FilePlusSHA256($inputCompName, $inputfile , $inputpath , $inputSHA2 )
                exitloop

        EndSelect
    WEnd


Func _FilePlusSHA256($strComputer, $Filename , $Path , $SHA256target)

    tooltip("Working...")

    If $Path = "" then $Path="\c$\"

        $aFiles = _FileListToArrayRec("\\" & $strComputer & $Path , "*" , 1, 1, 0, 2)


    If $inputfile <> "" Then
        $aFound = _ArrayFindAll($aFiles , $Filename , 0  , 0 , 0 , 1)
    Else
        $aFound = $aFiles

    Endif


If isArray($aFound) Then
    for $j = 1 to ubound($aFound) - 1


    $fHash = _Crypt_HashFile($aFound[$j] , $CALG_SHA_256)

consolewrite($aFound[$j] & @LF & $fhash & @LF)

    If $fHash = $inputSHA2 Then
        msgbox(0, 'FOUND' , $aFound[$j] & @LF & $fhash)
        Exit
    EndIf

next
Endif



EndFunc

 

1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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  
Followers 0