Hallo zusammen, ich hatte aus eigener faulheit mir ein kleines tool zu md5 geschrieben. soweit erledigt es seinen dienst ohne störende fehler. da ich aber noch sachen einbauen wollte wie die sicherheit des generierten hashes einzustufen, hätte ich gern das mir vll jemand code optimirungen vorschlagen kann und bei meinem problem mit dem logfile zeigen via trayitem... glaube ich hab da ne denkblockade. danke fürs reinschauen =)
die teile die jeweils unter den buttons ausgeführt werden, werde ich noch in funktionen splitten und seperieren.
Spoiler anzeigen
#include <INet.au3>
#include <array.au3>
#include <string.au3>
#include <Misc.au3>
#include "md5.au3"
#include <GUIConstants.au3>
#include <File.au3>
#Include <Constants.au3>
#include "funccs.au3"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MD5-Kid v0.1", 301, 342, 302, 176)
$Group1 = GUICtrlCreateGroup("Generate", 5, 5, 290, 80)
$Input1 = GUICtrlCreateInput("MyHash", 50, 25, 231, 21)
$Label1 = GUICtrlCreateLabel("String", 15, 25, 31, 17)
$Label2 = GUICtrlCreateLabel("Hash", 15, 55, 29, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input2 = GUICtrlCreateInput("", 50, 55, 231, 21)
$Group2 = GUICtrlCreateGroup("Lookup", 5, 90, 290, 85)
$Label3 = GUICtrlCreateLabel("Hash", 15, 110, 29, 17)
$Input3 = GUICtrlCreateInput("", 45, 110, 236, 21)
$Button1 = GUICtrlCreateButton("Hash", 45, 135, 110, 25, 0)
$Button2 = GUICtrlCreateButton("Gen Hash", 165, 135, 115, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Results", 5, 180, 290, 155)
$Edit1 = GUICtrlCreateEdit("", 10, 195, 280, 134)
GUICtrlCreateGroup("", -99, -99, 1, 1)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $Form1, $Input1, $Input2
Global $in = "string"
Global $url2 = "http://hashkiller.com/api/api.php?md5="
While 1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]If GUICtrlRead($Input1) <> $in Then
$in = GUICtrlRead($Input1)
GUICtrlSetData($Input2, _StringMD5($in))
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
[/autoit] [autoit][/autoit] [autoit]$ownhash = GUICtrlRead($Input3)
Global $pufh = $url2 & $ownhash
$sou = _INetGetSource($pufh)
sleep(1000)
$resu=_StringBetween($sou, ' <plain>','</plain>')
$stringi=_StringBetween($sou, ' <found>','</found>')
If IsArray($stringi) Then
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]if $stringi[0] = "true" then
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]GUICtrlSetData($Edit1,$resu[0] & " - " & $ownhash & @CRLF,1)
$log=($resu[0] & " - " & $ownhash)
_FileWriteLog(@ScriptDir & "\plainhashes.log","" & $log)
Else
[/autoit] [autoit][/autoit] [autoit]GUICtrlSetData($Edit1,"No Hash Found" & @CRLF,1)
[/autoit] [autoit][/autoit] [autoit]endif
[/autoit] [autoit][/autoit] [autoit]Else
GUICtrlSetData($Edit1,"No Hash Found" & @CRLF,1)
EndIf
Case $Button2
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$ownhash2 = GUICtrlRead($Input2)
Global $pufh = $url2 & $ownhash2
$sou = _INetGetSource($pufh)
[/autoit] [autoit][/autoit] [autoit]$resu=_StringBetween($sou, ' <plain>','</plain>')
$stringi=_StringBetween($sou, ' <found>','</found>')
If IsArray($stringi) Then
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]if $stringi[0] = "true" then
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$log=($resu[0] & " - " & $ownhash2)
_FileWriteLog(@ScriptDir & "\plainhashes.log","" & $log)
GUICtrlSetData($Edit1,$resu[0] & " - " & $ownhash2 & @CRLF,1)
else
[/autoit] [autoit][/autoit] [autoit]GUICtrlSetData($Edit1, "No Hash Found" & @CRLF,1)
[/autoit] [autoit][/autoit] [autoit]endif
[/autoit] [autoit][/autoit] [autoit]Else
GUICtrlSetData($Edit1,"No Hash Found" & @CRLF,1)
EndIf
EndSwitch
WEnd
und hier halt meine versuchte funktion via trayitem nen fenster mit dem logfile inhalt poppen zu lassen...
Spoiler anzeigen
func _log()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$loggi = TrayCreateItem("Show Log")
TrayCreateItem("")
$exitt = TrayCreateItem("Exit")
Global $logfile= FileOpen (@ScriptDir & "\plainhashes.log",0)
While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $loggi
$form2=GUICreate("MD5-Kid Log", 411, 296, 569, 435)
$Edit2 = GUICtrlCreateEdit("", 5, 5, 400, 284)
GUICtrlSetData($Edit2, $logfile,0)
FileClose($logfile)
GUISetState()
EndSelect
WEnd
EndFunc
[/autoit]
Basti