class Cradare2::DSL::Memory

Overview

DSL for memory inspection, reading, writing, and byte pattern searching.

Defined in:

cradare2/dsl/memory.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client) #

[View source]

Instance Method Detail

def hexdump(address : UInt64 | String | Nil = nil, size : Int32 = 64) : String #

Returns formatted hexdump text for human inspection.


[View source]
def read(address : UInt64 | String, size : Int32) : Bytes #

Reads raw bytes from address as a Crystal Bytes slice.


[View source]
def read_bytes(address : UInt64 | String, size : Int32) : Bytes #

Alias for #read.


[View source]
def read_f32(address : UInt64 | String) : Float32 #

Reads floating-point numbers.


[View source]
def read_f64(address : UInt64 | String) : Float64 #

[View source]
def read_hex(address : UInt64 | String, size : Int32) : String #

Reads bytes formatted as a continuous hex string.


[View source]
def read_i16(address : UInt64 | String) : Int16 #

[View source]
def read_i32(address : UInt64 | String) : Int32 #

[View source]
def read_i64(address : UInt64 | String) : Int64 #

[View source]
def read_i8(address : UInt64 | String) : Int8 #

Reads signed integers of various bit widths.


[View source]
def read_string(address : UInt64 | String, max_len : Int32 | Nil = nil) : String #

Reads a null-terminated C string from memory address.


[View source]
def read_u16(address : UInt64 | String) : UInt16 #

[View source]
def read_u32(address : UInt64 | String) : UInt32 #

[View source]
def read_u64(address : UInt64 | String) : UInt64 #

[View source]
def read_u8(address : UInt64 | String) : UInt8 #

Reads unsigned integers of various bit widths.


[View source]
def search_bytes(bytes : Bytes) : Array(UInt64) #

Searches memory for a byte pattern (e.g. Bytes[0x48, 0x89]).


[View source]
def search_string(query : String) : Array(UInt64) #

Searches memory for a string query.


[View source]
def write(address : UInt64 | String, bytes : Bytes) : self #

Writes a slice of bytes to the given address using wx.


[View source]
def write_hex(address : UInt64 | String, hex : String) : self #

Writes hex characters directly (e.g. "909090" for NOPs).


[View source]
def write_i32(address : UInt64 | String, value : Int32) : self #

[View source]
def write_i64(address : UInt64 | String, value : Int64) : self #

[View source]
def write_string(address : UInt64 | String, string : String) : self #

Writes a string to the given address.


[View source]
def write_u32(address : UInt64 | String, value : UInt32) : self #

Writes a 32-bit integer.


[View source]
def write_u64(address : UInt64 | String, value : UInt64) : self #

Writes a 64-bit integer.


[View source]