class
Cradare2::Client
- Cradare2::Client
- Reference
- Object
Overview
The central client representing an open radare2 session.
Defined in:
cradare2/bridge/elf_bridge.crcradare2/client.cr
cradare2/dsl/comments.cr
cradare2/dsl/disasm.cr
cradare2/dsl/flags.cr
cradare2/dsl/types.cr
cradare2/godot.cr
cradare2/ps2.cr
Constructors
Instance Method Summary
-
#all_strings : Array(Model::StringItem)
Returns strings from the entire binary (izzj).
-
#analyze : DSL::Analysis
Access the Analysis DSL.
- #analyze(&block : DSL::Analysis -> ) : self
-
#backtrace : Array(Model::StackFrame)
Returns call stack backtrace frames.
-
#base_address_of(module_name : String) : UInt64 | Nil
Returns the base load address of a specific loaded module by name.
-
#batch(commands : Array(String)) : Hash(String, String)
Executes a batch of commands sequentially, returning a mapping of Command => Output.
-
#breakpoint(target : Address) : self
Sets a software breakpoint at the given address or symbol.
-
#breakpoints : Array(Model::Breakpoint)
Returns active breakpoints.
-
#citrine : Platform::PS2::Helper
Citrine alias for
#ps2 - #citrine(&block : Platform::PS2::Helper -> ) : self
-
#clear_breakpoints : self
Clears all breakpoints and watchpoints.
-
#clear_command_hooks : self
Clears all registered command listeners.
-
#close : Nil
Closes the radare2 session.
-
#closed? : Bool
Returns true if the session is closed.
-
#cmd(command : String) : String
Executes a command string in radare2 and returns the raw output string.
-
#cmdj(command : String, as type : T.class) : T forall T
Executes a command and deserializes the JSON string into the specified type
T. -
#cmdj(command : String) : JSON::Any
Executes a command and parses the returned JSON string as
JSON::Any. -
#comments : DSL::Comments
Access the Comments DSL for managing code comments safely with Base64 encoding.
- #comments(&block : DSL::Comments -> ) : self
-
#continue : self
Continues execution of the debugged process.
-
#crystal : CrystalHelper
Access the Crystal binary analysis and memory inspection helper.
- #crystal(&block : CrystalHelper -> ) : self
-
#current_offset : UInt64
Returns the current seek position / offset.
-
#debug : DSL::Debugger
Access the Debugger DSL.
- #debug(&block : DSL::Debugger -> ) : self
-
#decompile(target : Address | Nil = nil) : String
Decompiles current function or target to C-like pseudocode.
-
#demangle(symbol : String) : String
Demangles a symbol using radare2 and internal caching.
-
#diagnose_crash : Model::CrashDiagnosis
Diagnoses execution crash.
-
#disasm : DSL::Disassembly
Access the Disassembly DSL.
-
#disasm_text(count : Int32 = 10, at : Address | Nil = nil) : String
Disassembles instructions returning human-readable text.
-
#disassemble(count : Int32 = 10, at : Address | Nil = nil) : Array(Model::Instruction)
Disassembles instructions returning typed Instruction models.
- #elf_bridge(binary_path : String = "binary.elf") : Cradare2::Bridge::ElfBridge
-
#exports : Array(Model::Export)
Returns exported symbols (iEj).
-
#exports_matching(pattern : Regex | String) : Array(Model::Export)
Filters exports matching a substring or regex pattern.
-
#find_function(name : String) : Model::Function | Nil
Finds a specific function by name.
-
#find_symbol(name : String) : Model::Symbol | Nil
Finds a specific symbol by name or display name.
-
#flags : DSL::Flags
Access the Flags DSL for managing symbols, labels, and markers.
- #flags(&block : DSL::Flags -> ) : self
-
#functions : Array(Model::Function)
Returns analyzed functions (aflj).
-
#functions_matching(pattern : Regex | String) : Array(Model::Function)
Filters functions matching a substring or regex pattern.
-
#godot : Engine::Godot::Helper
Access the Godot Engine and Lapis GDExtension helper.
- #godot(&block : Engine::Godot::Helper -> ) : self
-
#godot_object(address : Address) : Engine::Godot::GodotObjectHeader
Reads and decodes a Godot 4 Object header at the given virtual address.
-
#godot_variant(address : Address) : Engine::Godot::DecodedVariant
Reads and decodes a Godot 4 Variant payload at the given virtual address.
-
#hardware_breakpoint(target : Address) : self
Sets a hardware breakpoint at the given address or symbol.
-
#hexdump(address : Address | Nil = nil, size : Int32 = 64) : String
Returns formatted hexdump text for human inspection.
-
#imports : Array(Model::Import)
Returns imported symbols (iij).
-
#imports_matching(pattern : Regex | String) : Array(Model::Import)
Filters imports matching a substring or regex pattern.
-
#info : Model::BinaryInfo
Returns binary metadata (ij).
-
#lapis : Engine::Godot::Helper
Lapis alias for
#godot - #lapis(&block : Engine::Godot::Helper -> ) : self
-
#memory : DSL::Memory
Access the Memory DSL.
- #memory(&block : DSL::Memory -> ) : self
-
#module_at(address : Address) : Model::ModuleInfo | Nil
Returns the binary module containing the specified address.
-
#modules : Array(Model::ModuleInfo)
Returns loaded binary modules in the target process.
-
#on_command(&block : String, Time::Span, Bool -> Nil) : Nil
Registers a diagnostic listener block invoked after every command execution with (command, duration, success).
-
#ps2 : Platform::PS2::Helper
Access the PlayStation 2 Emotion Engine and Citrine platform helper.
- #ps2(&block : Platform::PS2::Helper -> ) : self
-
#quit : Nil
Alias for close.
-
#read(address : Address, size : Int32) : Bytes
Reads raw bytes from memory address as a Bytes slice.
-
#read_bytes(address : Address, size : Int32) : Bytes
Alias for read.
-
#read_cstring(address : Address, max_len : Int32 = 256) : String
Reads a null-terminated C-string from memory address.
-
#read_pointer_array(address : Address, count : Int32) : Array(UInt64)
Reads an array of 64-bit pointers from memory address.
-
#read_string(address : Address, max_len : Int32 | Nil = nil) : String
Reads a null-terminated string from memory address.
-
#registers : Model::Registers
Returns current CPU registers.
-
#remove_breakpoint(target : Address) : self
Removes a software or hardware breakpoint at the given address or symbol.
-
#remove_watchpoint(target : Address) : self
Removes a memory watchpoint at the given address or symbol.
-
#safe_cmdj(command : String, as type : T.class, default : T) : T forall T
Helper that catches JSON parse errors on empty/unparsed data, returning default value.
-
#safe_cmdj(command : String, as type : T.class) : T | Nil forall T
Safely parses JSON response into specified model type T, returning nil on parse error or empty output.
-
#safe_cmdj(command : String) : JSON::Any | Nil
Safely parses dynamic JSON response returning JSON::Any, or nil on parse error or empty output.
-
#sections : Array(Model::Section)
Returns binary sections (iSj).
-
#security : Model::SecurityInfo
Evaluates binary security mitigations (ASLR, DEP/NX, Stack Canary, Relocations).
-
#seek(target : Address) : self
Seeks to the specified target address or symbol (s
). -
#source_location_at(address : Address) : Lines::SourceLocation | Nil
Returns the source location corresponding to an instruction address if mapped.
-
#step(count : Int32 = 1) : self
Steps one single machine instruction (or count instructions).
-
#step_out : self
Steps out until exiting current stack frame.
-
#step_over(count : Int32 = 1) : self
Steps over calls or compound instructions.
-
#strings : Array(Model::StringItem)
Returns strings in data sections (izj).
-
#strings_matching(query : String) : Array(Model::StringItem)
Filters strings matching a substring.
-
#symbols : Array(Model::Symbol)
Returns all symbols in the binary (isj).
-
#symbols_matching(pattern : Regex | String) : Array(Model::Symbol)
Filters symbols matching a substring or regex pattern.
- #transport : Transport::Base
-
#types : DSL::Types
Access the Types DSL for defining and decoding binary structures via radare2 pf and pfj.
- #types(&block : DSL::Types -> ) : self
-
#watchpoint(target : Address, access : Symbol = :rw) : self
Sets a memory watchpoint on read/write/rw access.
-
#xrefs_from(address : Address) : Array(Model::Xref)
Returns cross-references originating from the specified address or symbol (axfj @
). -
#xrefs_to(address : Address) : Array(Model::Xref)
Returns cross-references targeting the specified address or symbol (axtj @
).
Constructor Detail
Instance Method Detail
Returns the base load address of a specific loaded module by name.
Executes a batch of commands sequentially, returning a mapping of Command => Output.
Sets a software breakpoint at the given address or symbol.
Executes a command string in radare2 and returns the raw output string.
Executes a command and deserializes the JSON string into the specified type T.
Executes a command and parses the returned JSON string as JSON::Any.
Access the Comments DSL for managing code comments safely with Base64 encoding.
Decompiles current function or target to C-like pseudocode.
Disassembles instructions returning human-readable text.
Disassembles instructions returning typed Instruction models.
Filters exports matching a substring or regex pattern.
Finds a specific symbol by name or display name.
Filters functions matching a substring or regex pattern.
Reads and decodes a Godot 4 Object header at the given virtual address.
Reads and decodes a Godot 4 Variant payload at the given virtual address.
Sets a hardware breakpoint at the given address or symbol.
Returns formatted hexdump text for human inspection.
Filters imports matching a substring or regex pattern.
Returns the binary module containing the specified address.
Registers a diagnostic listener block invoked after every command execution with (command, duration, success).
Access the PlayStation 2 Emotion Engine and Citrine platform helper.
Reads raw bytes from memory address as a Bytes slice.
Reads a null-terminated C-string from memory address.
Reads an array of 64-bit pointers from memory address.
Reads a null-terminated string from memory address.
Removes a software or hardware breakpoint at the given address or symbol.
Removes a memory watchpoint at the given address or symbol.
Helper that catches JSON parse errors on empty/unparsed data, returning default value.
Safely parses JSON response into specified model type T, returning nil on parse error or empty output.
Safely parses dynamic JSON response returning JSON::Any, or nil on parse error or empty output.
Evaluates binary security mitigations (ASLR, DEP/NX, Stack Canary, Relocations).
Seeks to the specified target address or symbol (s
Returns the source location corresponding to an instruction address if mapped.
Steps one single machine instruction (or count instructions).
Filters strings matching a substring.
Filters symbols matching a substring or regex pattern.
Access the Types DSL for defining and decoding binary structures via radare2 pf and pfj.
Sets a memory watchpoint on read/write/rw access.
Returns cross-references originating from the specified address or symbol (axfj @
Returns cross-references targeting the specified address or symbol (axtj @