goxymemmory

package module
v0.0.0-...-bd874a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 5 Imported by: 3

README

GoXyMemory

GoXyMemory is a port of XyMemory (Python) to GoLang. This project allows read and write process memory using a fork of syscalls wrapper called w32 from AllenDang.

Example of use

First, we need download and install this repo with go commands and next, use the DataManager class like the example below.

$> go get github.com/Xustyx/goxymemory
$> go install github.com/Xustyx/goxymemory
//Init
dm := goxymemmory.DataManager("StarCraft.exe") 	        //Get the DataManager with the process passed.
if !dm.IsOpen{				                            //Check if process was opened.
    fmt.Printf("Failed opening process.\n")
    return
}

//(READ/WRITE) String example.
err := dm.Write(0X0059B420,
    goxymemmory.Data{"TROLORO", goxymemmory.STRING})	//Write a string.
if err != nil {							                //Check if not failed.
    fmt.Printf("Failed writing memory. %s", err)
}
data, err := dm.Read(0X0059B420, goxymemmory.STRING)	//Reads the string.
if err != nil {						                    //Check if not failed.
    fmt.Printf("Failed reading memory. %s", err)
}
fmt.Println("STRING: ", data)					        //Print the value.

//(READ/WRITE) Byte example.
err = dm.Write(0X0059B420,
    goxymemmory.Data{256, goxymemmory.BYTE})		    //Write a byte.
if err != nil {							                //Check if not failed.
    fmt.Printf("Failed writing memory. %s", err)
}
data, err = dm.Read(0X0059B420 ,goxymemmory.BYTE)		//Reads the byte.
if err != nil {							                //Check if not failed.
    fmt.Printf("Failed reading memory. %s", err)
}
fmt.Println("BYTE: ", data)				            	//Print the value.

//(READ/WRITE) Int example.
err = dm.Write(0X0057F0F4,
    goxymemmory.Data{-1, goxymemmory.INT})			     //Write an int.
if err != nil {							                 //Check if not failed.
    fmt.Printf("Failed writing memory. %s", err)
}
data, err = dm.Read(0X0057F0F4, goxymemmory.INT)		//Reads the int.
if err != nil {						                	//Check if not failed.
    fmt.Printf("Failed reading memory. %s", err)
}
fmt.Println("INT: ", data)					            //Print the value.

//(READ/WRITE) Uint example.
err = dm.Write(0X0057F0F0,
    goxymemmory.Data{500, goxymemmory.UINT})	    	//Write an uint.
if err != nil {							                //Check if not failed.
    fmt.Printf("Failed writing memory. %s", err)
}
data, err = dm.Read(0X0057F0F0, goxymemmory.UINT)		//Reads the uint.
if err != nil {						                	//Check if not failed.
    fmt.Printf("Failed reading memory. %s", err)
}
fmt.Println("UINT: ", data)					            //Print the value.

Actually supported types and methods

Types
  • BYTE: 'byte'
  • STRING: 'string'
  • INT: 'int'
  • UINT: 'uint'
Methods (DataManager)
  • DataManager(processName string)
    • processName: The process name to handle.
  • read(address uint, dataType DataType)
    • address: Memory address in hexadecimal format.
    • dataType: The enum value of desired Type.
  • write(address uint, data Data)
    • address: Memory address in hexadecimal format.
    • data: Struct that contains the data to add and the enum value of desired Type.

Disclaimer

The author can not be held liable for any use of this code.

Documentation

Overview

This package implements functions to reads and writes process memory more easily.

Remember to execute with administrator privileges to grant debug on other process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataManager

func DataManager(processName string) *dataManager

Constructor of DataManager Param (processName) : The name of process to handle. Returns (*dataManager): A dataManager object.

Types

type Data

type Data struct {
	Value    interface{} //Any type value.
	DataType DataType    //Unwarp value.
}

This type warp the read and write values.

type DataException

type DataException error

Exception type of DataManager.

type DataType

type DataType int

Type of the data.

const (
	UINT DataType = iota
	INT
	BYTE
	STRING
)

Enum of data types.

func (DataType) String

func (data_type DataType) String() string

Get the string value from enum value.

type Process

type Process struct {
	Name string
	Pid  uint32
}

Type of simple process.

type ProcessException

type ProcessException error

Exception type of ProcessHandler.

func ProcessHandler

func ProcessHandler(processName string) (hProcess *processHandler, err ProcessException)

Constructor of ProcessHandler Param (processName) : The name of process to handle. Returns (*processHandler): A processHandler object. Errors (err) : Error if don't exist process with passed name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL