Upon starting Hilda, you are welcomed into Hilda's IPython shell.
You can access following set of methods via the variable p.
Basic flow control:
stop- Stop processcont- Continue processfinish- Run current function until returnstep_into- Step into current instructionstep_over- Step over current instructionrun_for- Run the process for given intervalforce_return- Prematurely return from a stack frame, short-circuiting execution of inner frames and optionally yielding a specified valuejump- Jump to given symbolwait_for_module- Wait for a module to be loaded (dlopen) by checking if given expression is contained within its filenamedetach- Detach from process (useful for exiting gracefully so the process doesn't get killed when you exit)
Breakpoints:
bporbreakpoints.add- Add a breakpointbreakpoints.show- Show existing breakpointsbreakpoints.remove- Remove a single breakpointbreakpoints.clear- Remove all breakpointsmonitororbreakpoints.add_monitor- Create a breakpoint whose callback implements the requested features (print register values, execute commands, mock return value, etc.)
Basic read/write:
-
get_register- Get register value -
set_register- Set register value -
poke- Write data at address -
peek[_str,_std_str]- Read buffer/C-string/std::stringat address -
po- Print object using LLDB'spocommand, or even run arbitrary native codep.po('NSMutableString *s = [NSMutableString string]; [s appendString:@"abc"]; [s description]')
-
disass- Print disassembly at address -
show_current_source- Print current source code (if possible) -
bt- Get backtrace -
lsof- Get all open FDs -
hd- Hexdump a buffer -
proc_info- Print information about currently running mapped process -
print_proc_entitlements- Get the plist embedded inside the process'__LINKEDITsection
Execute code:
call- Call function at given address with given parametersobjc_call- Simulate a call to an Objective-C selectorinject- Inject a single library into currently running processdisable_jetsam_memory_checks- Disable jetsam memory checks (to prevent raisingerror: Execution was interrupted, reason: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=15 MB, unused=0x0).when evaluating expressions).
Hilda symbols:
symbol- Get symbol object for a given addressobjc_symbol- Get Objective-C symbol wrapper for given addressfile_symbol- Calculate symbol address without ASLRglobalize_symbols- Make all symbols in python's global scope
Advanced:
-
lldb_handle_command- Execute an LLDB command (e.g.,p.lldb_handle_command('register read')) -
evaluate_expression- Use for quick code snippets (wrapper for LLDB'sEvaluateExpression).Take advantage of local variables inside the expression using format string, e.g.,
currentDevice = p.objc_get_class('UIDevice').currentDevice p.evaluate_expression(f'[[{currentDevice} systemName] hasPrefix:@"2"]')
-
import_module- Import & reload given Python module (intended mainly for external snippets) -
unwind- Unwind the stack (useful whenget_evaluation_unwind() == False) -
set_selected_thread- Set the currently selected thread, which is used in other parts of the program, such as displaying disassembly or checking registers. This ensures the application focuses on the specified thread for these operations.
Objective-C related:
objc_get_class- Get Objective-C class objectCFSTR- CreateCFStringRefobject from given stringns- CreateNSObjectfrom given datacf- Alias ofnsdecode_cf- Create a Python object from an NS object