Jump to content

Simple Memory Editor


Thamiel
 Share

Recommended Posts

This little bit of code was made because I needed a way to change values in the memory space of a running program on the fly with different values.

and as such I just made my own tool for it with AutoIt and here is the result of that endeavor, any comments on ways to do any of it better welcomed

#cs
Memory_Editor.au3 - It's not fancy and may not be the best way to do it, but it does what I needed it for ;-)
#ce

#Include <NomadMemory.au3>
#include <string.au3>

$i = 1

While $i = 1
    $Do_It = MsgBox(262148, "Do You Wish To Edit A Program's Memory Space ?", _
    "Do You Wish To Continue [Yes / No] ?" & @LF & "Also You Can Enter x At Anytime To Exit")
    If $Do_It = 6 Then _Edit()
    If $Do_It = 7 Then Exit
WEnd

Func _Edit()
$File = InputBox("Process to use", "Enter Process Name From Taskman", "" , " M", 75, 20, -1, -1)
If $File = 'x' Then Exit

$Addy = "0x" & InputBox("Address to use", "Enter Start Address [Hex]", "", " M", 75, 130, -1, -1)
If $Addy = 'x' Then Exit

$Type = InputBox("Data Type", "Enter 1 for Text" & @lf & "Enter 2 for Hex", "", " M", 75, 130, -1, -1)
If $Type = 'x' Then Exit
If $Type = '1' Then
    $Text = InputBox("New Data", "Enter Text String", "", " M", 600, 130, @DesktopWidth/4, -1)
    $Data = "0x" & _StringToHex($Text)
    ElseIf $Type = "2" Then
    $Data = "0x" & InputBox("New Data", "Enter Hex Data", "", " M", 600, 130, @DesktopWidth/4, -1)
    Else
Exit

EndIf

$Proc = ProcessList($File)
    $ID = _MemoryOpen($Proc[1][1])
    If @Error Then
    MsgBox(262144, "ERROR", "Failed to open memory")
    EndIf
    _MemoryWrite($Addy, $ID, $Data, 'byte[' & StringLen($Data)/2-1 & ']')
    _MemoryClose($ID)
    MsgBox(262144,"Confirmed", "Memory Edited")
EndFunc
Edited by Thamiel
Link to comment
Share on other sites

please use [ autoit ] tags?

Curently writing a autoit installerAutoit installer 83 and 2 thirds%-template 100%-script syntax 100%-script parser 50%--error checking 100%--actual parsing 50%--combining template and parsed crap 0%Template.au3 - 4.15kbparser.au3 - 1.94kb

Link to comment
Share on other sites

This little bit of code was made because I needed a way to change values in the memory space of a running program on the fly with different values.

and as such I just made my own tool for it with AutoIt and here is the result of that endeavor, any comments on ways to do any of it better welcomed

CODE

#cs

Memory_Editor.au3 - It's not fancy and may not be the best way to do it, but it does what I needed it for ;-)

#ce

#Include <NomadMemory.au3>

#include <string.au3>

$i = 1

While $i = 1

$Do_It = MsgBox(262148, "Do You Wish To Edit A Program's Memory Space ?", _

"Do You Wish To Continue [Yes / No] ?" & @LF & "Also You Can Enter x At Anytime To Exit")

If $Do_It = 6 Then _Edit()

If $Do_It = 7 Then Exit

WEnd

Func _Edit()

$File = InputBox("Process to use", "Enter Process Name From Taskman", "" , " M", 75, 20, -1, -1)

If $File = 'x' Then Exit

$Addy = "0x" & InputBox("Address to use", "Enter Start Address [Hex]", "", " M", 75, 130, -1, -1)

If $Addy = 'x' Then Exit

$Type = InputBox("Data Type", "Enter 1 for Text" & @lf & "Enter 2 for Hex", "", " M", 75, 130, -1, -1)

If $Type = 'x' Then Exit

If $Type = '1' Then

$Text = InputBox("New Data", "Enter Text String", "", " M", 600, 130, @DesktopWidth/4, -1)

$Data = "0x" & _StringToHex($Text)

ElseIf $Type = "2" Then

$Data = "0x" & InputBox("New Data", "Enter Hex Data", "", " M", 600, 130, @DesktopWidth/4, -1)

Else

Exit

EndIf

$Proc = ProcessList($File)

$ID = _MemoryOpen($Proc[1][1])

If @Error Then

MsgBox(262144, "ERROR", "Failed to open memory")

EndIf

_MemoryWrite($Addy, $ID, $Data, 'byte[' & StringLen($Data)/2-1 & ']')

_MemoryClose($ID)

MsgBox(262144,"Confirmed", "Memory Edited")

EndFunc

A good start to a useful script Thamiel.

If you are thinking of developing it I would suggest trying to get one gui to replace all the inputs, have radio buttons for options rather than entering a nuimber, and display the current contents of a memory location with an option to change it. A bit more error checking would be helpful.

BTW, related to crapmail's contribution post, I prefer CODE tags as my signature verifies.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

please use [ autoit ] tags?

Please buy a box of crayons.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...