Skip to content

Debug macOS and iOS processes from a Python shell

Hilda puts LLDB inside IPython. Attach to a process, then read memory, call functions, hook Objective-C selectors and set breakpoints, all as plain Python objects.

xcrun python3 -m pip install --user -U hilda

Named after Frida's best friend: Hilda takes the debugger's approach.

hilda — sysmond
$ hilda attach -n sysmond
In [1]: p.symbols.malloc(10)
Out[1]: AnonymousSymbol(0x0000600002B3C030)
In [2]: p.symbols.open.monitor(regs={'x0': 'x'}, bt=True)
In [3]: NSDictionary.capture_self(True).show()
In [4]: from hilda.snippets import xpc; xpc.sniff_all()
In [5]: p.cont()

Addresses are Python ints

A Symbol is an int that knows how to read, write, call and monitor the memory it points at. ASLR offsets are handled for you.

s = p.symbols.malloc(16)
s.poke(b'hilda')
print(s.peek(5))

p.symbols.open.monitor(regs={'x0': 'x'}, bt=True)

Objective-C, natively

Exported classes are available by name. List their methods, call selectors, and capture live instances. See Objective-C support.

d = NSDictionary.new()
print(NSDictionary.methods.filter_startswith('init'))

obj = NSDictionary.capture_self(True)
obj.show()

Recipes for common jobs

Snippets cover everyday tasks such as sniffing XPC traffic, inspecting dyld and walking Mach-O images.

from hilda.snippets import xpc

xpc.sniff_all()

Scripts, not just sessions

Everything you do in the shell also works from a standalone script. See modes of operation.

from hilda.launch_lldb import create_hilda_client_using_attach_by_name

p = create_hilda_client_using_attach_by_name('sysmond')
print(p.symbols.malloc(10))
p.detach()

See the process state

Hilda shows the stopped process in a configurable UI with four views: Registers, Disassembly, Stack and Backtrace.

Hilda UI showing registers, disassembly, stack and backtrace

Where to go next