WSCPorts Posted September 10, 2005 Share Posted September 10, 2005 (edited) expandcollapse popup#include <GUIConstants.au3> #include <mem.au3> #include <_APIREADWRITE.au3> Func _HexToString($strHex) Local $strChar, $aryHex, $i, $iDec, $Char, $file, $iOne, $iTwo $aryHex = StringSplit($strHex, "") For $i = 1 To $aryHex[0] $iOne = $aryHex[$i] $i = $i + 1 $iTwo = $aryHex[$i] $iDec = Dec($iOne & $iTwo) If @error <>0 Then MsgBox( 4096, "error occured", "Non-Translateble Chars or less than 1 charecter" & @CRLF & "Ouput Field Reset") Return ""; reset feild dont crash.. EndIf $Char = Chr($iDec) $strChar = $strChar & $Char Next Return $strChar EndFunc Func _StringToHex($strChar) Local $aryChar, $i, $iDec, $hChar, $file, $strHex $aryChar = StringSplit($strChar, "" ) For $i = 1 To $aryChar[0] $iDec = Asc($aryChar[$i]) $hChar = Hex($iDec, 2) $strHex = $strHex & $hChar & " " Next Return $strHex EndFunc Dim $i_ReadAddy, $i_ReadSize, $i_WriteAddy, $i_WriteData, $i_WriteSize, $i_Memhandle, $ReadOut, $WriteRetVal, $i_PtrAddy; declare Dynamic Objects $GuiObjS = GUICreate("Sting to Hex", 300, 300, 200, 250) GuiCtrlCreateLabel("String Please", 0, 0, 40,40) $i_String = GuiCtrlCreateInput( "string here", 0, 30, 150, 60) GUICtrlCreateLabel("OutPut Hex", 0, 90, 40, 40) $HexOut = GuiCtrlCreateInput("", 0, 120, 150, 60) $b_GuiString = GUICtrlCreateButton("To Hex", 150, 90, 90, 30) $FormatSC = GUICtrlCreateButton("Format with Commas", 150, 120, 120, 30) $FormatSR = GUICtrlCreateButton("Remove white Space", 150, 150, 120, 30) $h_GuiString = GUICtrlCreateButton("Hide-Show", 150, 0, 90, 30) GUISetState(@SW_SHOW, $GuiObjS) $GuiObjH = GUICreate("Hex to string", 300, 300, 400, 250) GuiCtrlCreateLabel("Hex Please", 0, 0, 40,40) $i_Hex = GuiCtrlCreateInput( "hex here", 0, 30, 150, 60) GUICtrlCreateLabel("OutPut string", 0, 90, 40, 40) $StringOut = GuiCtrlCreateInput("", 0, 120, 150, 60) $b_GuiHex = GUICtrlCreateButton("To String", 150, 90, 90, 30) $h_GuiHex = GUICtrlCreateButton("Hide-Show", 150, 0, 90, 30) GUISetState(@SW_SHOW, $GuiObjH) $GuiObjI = GUICreate("Injection Screen", 400, 400, 400, 50) GuiCtrlCreateLabel("Select a Process", 0, 0, 40, 40) $APLInput = GUICtrlCreateList("", 0, 30, 100, 40) $APL = ProcessList() for $i = 1 to $APL[0][0] GUICtrlSetData($APLInput, $APL[$i][0], 0) next $b_OpenProcess = GUICtrlCreateButton("Click to open a process", 0, 65, 120, 40) GuiCtrlCreateLabel(" Hex deliminated" & @CR & "by commas only!! ", 100, 0, 60, 80) $i_Inject = GuiCtrlCreateInput( "", 160, 0, 140, 80) $b_inject = GUICtrlCreateButton("inject hex", 305, 0, 90, 30) $h_Inject = GUICtrlCreateButton("Hide Injector", 305, 35, 90, 30) $b_ReadMem = GUICtrlCreateButton("Read Memory", 40, 180, 90, 30) $b_WriteMem = GUICtrlCreateButton("Write Memory", 40, 250, 90, 30) $b_PtrSet = GUICtrlCreateButton("Set Pointer", 195, 300, 90, 30) GUISetState(@SW_SHOW, $GuiObjI) while(1) $GuiMsg = GUIGetMsg() Select Case $GuiMsg = $b_GuiString $toHex = GUICtrlRead($i_String, 0) $Hexer = _StringToHex($toHex) ;GUICtrlSetData($HexOut, "", 0) GUICtrlSetData($HexOut, $Hexer, 0) Case $GuiMsg = $b_GuiHex $toString = GUICtrlRead($i_Hex, 0) $Stringer = _HexToString($toString) ;GUICtrlSetData($StringOut, "", 0) GUICtrlSetData($StringOut, $Stringer, 0) Case $GuiMsg = $b_OpenProcess $Process = GUICtrlRead($APLInput, 0) $i_MemHandle = _MemOpen($Mem_All, False, ProcessExists($Process)) ;GUICtrlSetData($InjectInput, $Process, 0) GUICtrlCreateLabel("Memory read", 0, 150, 40, 40) $i_ReadAddy = GUICtrlCreateInput("Address to read hex 0x", 40, 150, 155, 30) GUICtrlCreateLabel("Size to Read", 195, 120, 40, 40) $i_ReadSize = GUICtrlCreateList("", 195, 150, 80, 30) GUICtrlSetData($i_ReadSize, 1, 0) GUICtrlSetData($i_ReadSize, 2, 0) GUICtrlSetData($i_ReadSize, 3, 0) GUICtrlSetData($i_ReadSize, 4, 0) GUICtrlCreateLabel("Memory Write", 0, 220, 40, 40) $i_WriteAddy = GUICtrlCreateInput("Address to write to hex 0x", 40, 220, 155, 30) $i_WriteData = GUICtrlCreateInput("data to write 0x", 195, 220, 75, 30) GUICtrlCreateLabel("Size to Write", 270, 190, 40, 40) $i_WriteSize = GUICtrlCreateList("", 270, 220, 80, 30) GUICtrlSetData($i_WriteSize, 1, 0) GUICtrlSetData($i_WriteSize, 2, 0) GUICtrlSetData($i_WriteSize, 3, 0) GUICtrlSetData($i_WriteSize, 4, 0) GUICtrlCreateLabel("Set Pointer", 0, 300, 40, 40) $i_PtrAddy = GUICtrlCreateInput("Set Pointer here 0x", 40, 300, 155, 30) Case $GuiMsg = $b_ReadMem $RetMem = _MemRead($i_Memhandle, GUICtrlRead($i_ReadAddy, 0), GUICtrlRead($i_ReadSize, 0)) $ReadOut = GUICtrlCreateInput("", 130, 180, 90, 30) GUICtrlSetData($ReadOut, $RetMem, 0) Case $GuiMsg = $b_WriteMem $WriteMem = _MemWrite($i_Memhandle, $i_WriteAddy, $i_WriteData, $i_WriteSize) $WriteRetVal = GUICtrlCreateInput("", 130, 250, 90, 30) GUICtrlSetData($WriteRetVal, $WriteMem, 0) Case $GuiMsg = $b_PtrSet $Sptr = _APIFileSetPos($i_Memhandle, GUICtrlRead($i_PtrAddy, 0)) Case $GuiMsg = $FormatSC $Test = GUICtrlRead($HexOut, 0) $Tested = StringRegExpReplace($Test, "(\s)", ',') GUICtrlSetData($HexOut, $Tested, 0) Case $GuiMsg = $FormatSR $test = GUICtrlRead($HexOut, 0) $tested = StringStripWS($test, 8) ;GUICtrlSetData($HexOut, "", 0) GUICtrlSetData($HexOut, $tested, 0) Case $GuiMsg = $h_GuiString GUISetState(@SW_HIDE, $GuiObjS) GUISetState(@SW_HIDE, $GuiObjH) GUISetState(@SW_SHOW, $GuiObjI) Case $GuiMsg = $h_GuiHex GUISetState(@SW_HIDE, $GuiObjH) GUISetState(@SW_HIDE, $GuiObjS) GUISetState(@SW_SHOW, $GuiObjI) Case $GuiMsg = $h_Inject GUISetState(@SW_HIDE, $GuiObjI) GUISetState(@SW_SHOW, $GuiObjH) GUISetState(@SW_SHOW, $GuiObjS) Case $GuiMsg = $GUI_EVENT_CLOSE _MemClose($i_Memhandle) Exit EndSelect WEnd used non-confusing names Still need some work on writing binary(hex) to Files. any help would be greatly appreciated :"> Edited September 11, 2005 by WSCPorts http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now