MemoryProcess is an NPM package to read and write process memory
This is a fork of the original memoryjs package, maintained by JoShMiQueL
If you want to bundle your .ts code to .js using Bun, add memoryprocess to the --external option when running bun build. For example:
bun build src/index.ts --external memoryprocess-
openProcess(processIdentifier: string | number, callback?): Process
Opens a process by name or ID. Returns the process handle or undefined if not found. -
closeHandle(handle: number): boolean
Closes a process handle. -
getProcesses(callback?): Process[]
Returns the list of running processes. -
findModule(moduleName: string, processId: number, callback?): Module | undefined
Finds a module by name in a process. -
getModules(processId: number, callback?): Module[]
Returns the modules loaded by a process. -
readMemory(handle: number, address: number, dataType: T, callback?): MemoryData | undefined
Reads a value from a process's memory. -
writeMemory(handle: number, address: number, value: any, dataType: DataType): boolean
Writes a value to a process's memory. -
findPattern(...)
Scans memory patterns (multiple overloads). -
callFunction(handle: number, args: any[], returnType: number, address: number, callback?): any
Calls a function in the process's memory. -
Debugger
Utility class for process debugging. Main methods:attach,detach,setHardwareBreakpoint,removeHardwareBreakpoint,monitor. -
virtualAllocEx, virtualProtectEx, getRegions, virtualQueryEx, injectDll, unloadDll, openFileMapping, mapViewOfFile
Advanced memory and DLL manipulation functions.
-
type DataType
Supported data types for memory read/write:'byte','int32','float','string','vector3', etc. -
type MemoryData
Maps aDataTypeto its corresponding JS type (number,bigint,string,{x,y,z}...) -
interface Process
Information about an opened process (PID, handle, etc). -
interface Module
Information about a module loaded in a process. -
type Protection, PageProtection, AllocationType, BreakpointTriggerType
Auxiliary types for memory flags and protection. -
const FunctionTypes, SignatureTypes, MemoryAccessFlags, MemoryPageFlags, HardwareDebugRegisters, BreakpointTriggerTypes
Constants for flags and function types.
See the
srcfolder for full details and comments on each function/type.