hilda 2.0.2__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hilda-2.0.2 → hilda-2.0.3}/PKG-INFO +142 -192
- {hilda-2.0.2 → hilda-2.0.3}/README.md +141 -191
- {hilda-2.0.2 → hilda-2.0.3}/hilda/_version.py +2 -2
- {hilda-2.0.2 → hilda-2.0.3}/hilda/cli.py +37 -30
- {hilda-2.0.2 → hilda-2.0.3}/hilda/exceptions.py +4 -7
- {hilda-2.0.2 → hilda-2.0.3}/hilda/hilda_client.py +58 -33
- {hilda-2.0.2 → hilda-2.0.3}/hilda/launch_lldb.py +37 -51
- {hilda-2.0.2 → hilda-2.0.3}/hilda.egg-info/PKG-INFO +142 -192
- hilda-2.0.3/tests/conftest.py +12 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_hilda_client/test_registers.py +11 -1
- hilda-2.0.2/tests/conftest.py +0 -32
- {hilda-2.0.2 → hilda-2.0.3}/.github/workflows/python-app.yml +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/.github/workflows/python-publish.yml +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/.gitignore +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/.pre-commit-config.yaml +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/LICENSE +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/gifs/.gitattributes +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/gifs/ui.png +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/gifs/xpc_print_message.gif +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/__init__.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/__main__.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/common.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/hilda_ascii_art.html +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/ipython_extensions/events.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/ipython_extensions/keybindings.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/ipython_extensions/magics.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/lldb_entrypoint.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/lldb_importer.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c/from_ns_to_json.m +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c/get_objectivec_class_by_module.m +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c/get_objectivec_class_description.m +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c/get_objectivec_symbol_data.m +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c/lsof.m +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c/to_ns_from_json.m +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c_class.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/objective_c_symbol.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/registers.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/__init__.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/boringssl.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/collections.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/dyld.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/fs_utils.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/mach/CFRunLoopServiceMachPort_hooks.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/mach/__init__.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/macho/__init__.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/macho/all_image_infos.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/macho/apple_version.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/macho/image_info.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/macho/macho.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/macho/macho_load_commands.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/remotepairingd.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/syslog.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/uuid.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/snippets/xpc.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/symbol.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/symbols_jar.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/ui/colors.json +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/ui/ui_manager.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda/ui/views.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda.egg-info/SOURCES.txt +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda.egg-info/dependency_links.txt +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda.egg-info/entry_points.txt +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda.egg-info/requires.txt +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/hilda.egg-info/top_level.txt +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/pyproject.toml +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/requirements.txt +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/setup.cfg +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/__init__.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_hilda_client/test_from_ns.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_hilda_client/test_hilda_client.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_hilda_client/test_monitor.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_hilda_client/test_ns.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_hilda_client/test_rebind_symbols.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_snippets/test_xpc.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_symbols/test_objective_c_class.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_symbols/test_objective_c_symbol.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_symbols/test_symbol.py +0 -0
- {hilda-2.0.2 → hilda-2.0.3}/tests/test_symbols/test_symbols_jar.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hilda
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: LLDB wrapped and empowered by iPython's features
|
|
5
5
|
Author-email: doronz88 <doron88@gmail.com>, matan <matan1008@gmail.com>, netanel cohen <netanelc305@protonmail.com>
|
|
6
6
|
Maintainer-email: doronz88 <doron88@gmail.com>, matan <matan1008@gmail.com>, netanel cohen <netanelc305@protonmail.com>
|
|
@@ -55,34 +55,28 @@ Requires-Dist: inquirer3
|
|
|
55
55
|
Provides-Extra: test
|
|
56
56
|
Requires-Dist: pytest; extra == "test"
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- [Using snippets](#using-snippets)
|
|
81
|
-
- [Contributing](#contributing)
|
|
82
|
-
|
|
83
|
-
Would you like any further adjustments?
|
|
84
|
-
|
|
85
|
-
# Description
|
|
58
|
+
# Hilda
|
|
59
|
+
|
|
60
|
+
- [Hilda](#hilda)
|
|
61
|
+
- [Overview](#overview)
|
|
62
|
+
- [Installation](#installation)
|
|
63
|
+
- [How to use](#how-to-use)
|
|
64
|
+
- [Starting a Hilda interactive shell](#starting-a-hilda-interactive-shell)
|
|
65
|
+
- [Inside a Hilda shell](#inside-a-hilda-shell)
|
|
66
|
+
- [Magic functions](#magic-functions)
|
|
67
|
+
- [Key-bindings](#key-bindings)
|
|
68
|
+
- [Configurables](#configurables)
|
|
69
|
+
- [UI Configuration](#ui-configuration)
|
|
70
|
+
- [Python API](#python-api)
|
|
71
|
+
- [Symbol objects](#symbol-objects)
|
|
72
|
+
- [Globalized symbols](#globalized-symbols)
|
|
73
|
+
- [Searching for the right symbol](#searching-for-the-right-symbol)
|
|
74
|
+
- [Objective-C Classes](#objective-c-classes)
|
|
75
|
+
- [Objective-C Objects](#objective-c-objects)
|
|
76
|
+
- [Using snippets](#using-snippets)
|
|
77
|
+
- [Contributing](#contributing)
|
|
78
|
+
|
|
79
|
+
## Overview
|
|
86
80
|
|
|
87
81
|
Hilda is a debugger which combines both the power of LLDB and iPython for easier debugging.
|
|
88
82
|
|
|
@@ -94,8 +88,8 @@ debugger-y" approach (based on LLDB).
|
|
|
94
88
|
Currently, the project is intended for iOS/OSX debugging, but in the future we will possibly add support for the
|
|
95
89
|
following platforms as well:
|
|
96
90
|
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
- Linux
|
|
92
|
+
- Android
|
|
99
93
|
|
|
100
94
|
Since LLDB allows abstraction for both platform and architecture, it should be possible to make the necessary changes
|
|
101
95
|
without too many modifications.
|
|
@@ -105,14 +99,14 @@ Pull requests are more than welcome 😊.
|
|
|
105
99
|
If you need help or have an amazing idea you would like to suggest, feel free
|
|
106
100
|
to [start a discussion 💬](https://github.com/doronz88/hilda/discussions).
|
|
107
101
|
|
|
108
|
-
|
|
102
|
+
## Installation
|
|
109
103
|
|
|
110
104
|
Requirements for remote iOS device (not required for debugging a local OSX process):
|
|
111
105
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
- Jailbroken iOS device
|
|
107
|
+
- `debugserver` in device's PATH
|
|
108
|
+
- [You can use this tool in order to obtain the binary](https://github.com/doronz88/debugserver-deploy)
|
|
109
|
+
- After re-signing with new entitlements, you can put the binary in the following path: `/usr/bin/debugserver`
|
|
116
110
|
|
|
117
111
|
In order to install please run:
|
|
118
112
|
|
|
@@ -122,104 +116,40 @@ xcrun python3 -m pip install --user -U hilda
|
|
|
122
116
|
|
|
123
117
|
*⚠️ Please note that Hilda is installed on top of XCode's python so LLDB will be able to use its features.*
|
|
124
118
|
|
|
125
|
-
|
|
119
|
+
## How to use
|
|
126
120
|
|
|
127
|
-
|
|
121
|
+
### Starting a Hilda interactive shell
|
|
128
122
|
|
|
129
|
-
|
|
123
|
+
You can may start a Hilda interactive shell by invoking any of the subcommand:
|
|
130
124
|
|
|
131
|
-
|
|
125
|
+
- `hilda launch /path/to/executable`
|
|
126
|
+
- Launch given executable on current host
|
|
127
|
+
- `hilda attach [-p pid] [-n process-name]`
|
|
128
|
+
- Attach to an already running process on current host (specified by either `pid` or `process-name`)
|
|
129
|
+
- `hilda remote HOSTNAME PORT`
|
|
130
|
+
- Attach to an already running process on a target host (sepcified by `HOSTNAME PORT`)
|
|
131
|
+
- `hilda bare`
|
|
132
|
+
- Only start an LLDB shell and load Hilda as a plugin.
|
|
133
|
+
- Please refer to the following help page if you require help on the command available to you within the lldb shell:
|
|
132
134
|
|
|
133
|
-
|
|
134
|
-
hilda attach [-p pid] [-n process-name]
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Launch mode
|
|
138
|
-
|
|
139
|
-
Use the attach sub-command in order to launch given process.
|
|
140
|
-
|
|
141
|
-
```shell
|
|
142
|
-
hilda launch /path/to/executable \
|
|
143
|
-
--argv arg1 --argv arg2 \
|
|
144
|
-
--envp NAME=Alice --envp AGE=30 \
|
|
145
|
-
--stdin /path/to/input.txt \
|
|
146
|
-
--stdout /path/to/output.txt \
|
|
147
|
-
--stderr /path/to/error.txt \
|
|
148
|
-
--wd /path/to/working/directory \
|
|
149
|
-
--flags 0x01 \
|
|
150
|
-
--stop-at-entry
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Bare mode
|
|
154
|
-
|
|
155
|
-
Use "Bare mode" to get a "bare-bones" lldb shell, whereas hilda plugin is already loaded and ready to start. This mode
|
|
156
|
-
is useful when you need to have custom commands for attaching to the target process (for example when debugging OSX
|
|
157
|
-
processes).
|
|
158
|
-
|
|
159
|
-
To start this mode simply use:
|
|
160
|
-
|
|
161
|
-
```shell
|
|
162
|
-
hilda bare
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Please refer to the following help page if you require help on the command available to you within the lldb shell:
|
|
166
|
-
|
|
167
|
-
[lldb command map](https://lldb.llvm.org/use/map.html).
|
|
168
|
-
|
|
169
|
-
As a cheatsheet, connecting to a remote platform like so:
|
|
170
|
-
|
|
171
|
-
```shell
|
|
172
|
-
platform connect connect://ip:port
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
... and attaching to a local process:
|
|
176
|
-
|
|
177
|
-
```shell
|
|
178
|
-
process attach -n proccess_name
|
|
179
|
-
process attach -p proccess_pid
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
When you are ready, just execute `hilda` to move to Hilda's iPython shell.
|
|
183
|
-
|
|
184
|
-
### Remote mode
|
|
185
|
-
|
|
186
|
-
This mode will auto-connect to the remote device and attach to your target process assuming you are trying to debug a
|
|
187
|
-
remote jailbroken iOS device.
|
|
188
|
-
|
|
189
|
-
Please note the following:
|
|
190
|
-
|
|
191
|
-
* script assumes the connected device already **has a running ssh server**, which doesn't require a password (you can
|
|
192
|
-
use
|
|
193
|
-
`ssh-copy-id` to achieve this).
|
|
135
|
+
[lldb command map](https://lldb.llvm.org/use/map.html).
|
|
194
136
|
|
|
195
|
-
|
|
137
|
+
As a cheatsheet, connecting to a remote platform like so:
|
|
196
138
|
|
|
197
|
-
|
|
139
|
+
```shell
|
|
140
|
+
platform connect connect://ip:port
|
|
141
|
+
```
|
|
198
142
|
|
|
199
|
-
|
|
143
|
+
... and attaching to a local process:
|
|
200
144
|
|
|
201
|
-
```shell
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
## Startup Files
|
|
206
|
-
|
|
207
|
-
Each command can accept startup files to execute on start. As opposed to snippets, the startup files can accept Hilda
|
|
208
|
-
syntax.
|
|
209
|
-
|
|
210
|
-
#### Startup File Example
|
|
211
|
-
|
|
212
|
-
```python
|
|
213
|
-
cfg.objc_verbose_monitor = True
|
|
214
|
-
p.bp(ADDRESS)
|
|
215
|
-
p.cont()
|
|
216
|
-
```
|
|
145
|
+
```shell
|
|
146
|
+
process attach -n proccess_name
|
|
147
|
+
process attach -p proccess_pid
|
|
148
|
+
```
|
|
217
149
|
|
|
218
|
-
|
|
219
|
-
hilda remote HOSTNAME PORT -f startupfile1 -f startupfile2
|
|
220
|
-
```
|
|
150
|
+
When you are ready, just execute `hilda` to move to Hilda's iPython shell.
|
|
221
151
|
|
|
222
|
-
|
|
152
|
+
### Inside a Hilda shell
|
|
223
153
|
|
|
224
154
|
Upon starting Hilda shell, you are greeted with:
|
|
225
155
|
|
|
@@ -232,52 +162,53 @@ Have a nice flight ✈️! Starting an IPython shell...
|
|
|
232
162
|
Here is a gist of methods you can access from `p`:
|
|
233
163
|
|
|
234
164
|
- `hd`
|
|
235
|
-
|
|
165
|
+
- Print an hexdump of given buffer
|
|
236
166
|
- `lsof`
|
|
237
|
-
|
|
167
|
+
- Get dictionary of all open FDs
|
|
238
168
|
- `bt`
|
|
239
|
-
|
|
169
|
+
- Print an improved backtrace.
|
|
240
170
|
- `disable_jetsam_memory_checks`
|
|
241
|
-
|
|
171
|
+
- Disable jetsam memory checks, prevent raising:
|
|
242
172
|
`error: Execution was interrupted, reason: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=15 MB, unused=0x0).`
|
|
243
173
|
when evaluating expression.
|
|
244
174
|
- `symbol`
|
|
245
|
-
|
|
175
|
+
- Get symbol object for a given address
|
|
246
176
|
- `objc_symbol`
|
|
247
|
-
|
|
177
|
+
- Get objc symbol wrapper for given address
|
|
248
178
|
- `inject`
|
|
249
|
-
|
|
179
|
+
- Inject a single library into currently running process
|
|
250
180
|
- `rebind_symbols`
|
|
251
|
-
|
|
181
|
+
- Reparse all loaded images symbols
|
|
252
182
|
- `poke`
|
|
253
|
-
|
|
183
|
+
- Write data at given address
|
|
254
184
|
- `peek`
|
|
255
|
-
|
|
185
|
+
- Read data at given address
|
|
256
186
|
- `peek_str`
|
|
257
|
-
|
|
187
|
+
- Peek a buffer till null termination
|
|
258
188
|
- `stop`
|
|
259
|
-
|
|
189
|
+
- Stop process.
|
|
260
190
|
- `cont`
|
|
261
|
-
|
|
191
|
+
- Continue process.
|
|
262
192
|
- `detach`
|
|
263
|
-
|
|
193
|
+
- Detach from process.
|
|
264
194
|
Useful in order to exit gracefully so process doesn't get killed
|
|
265
195
|
while you exit
|
|
266
196
|
- `disass`
|
|
267
|
-
|
|
197
|
+
- Print disassembly from a given address
|
|
268
198
|
- `file_symbol`
|
|
269
|
-
|
|
199
|
+
- Calculate symbol address without ASLR
|
|
270
200
|
- `get_register`
|
|
271
|
-
|
|
201
|
+
- Get value for register by its name
|
|
272
202
|
- `set_register`
|
|
273
|
-
|
|
203
|
+
- Set value for register by its name
|
|
274
204
|
- `objc_call`
|
|
275
|
-
|
|
205
|
+
- Simulate a call to an objc selector
|
|
276
206
|
- `call`
|
|
277
|
-
|
|
207
|
+
- Call function at given address with given parameters
|
|
278
208
|
- `monitor`
|
|
279
|
-
|
|
209
|
+
- Monitor every time a given address is called
|
|
280
210
|
The following options are available:
|
|
211
|
+
|
|
281
212
|
```
|
|
282
213
|
regs={reg1: format}
|
|
283
214
|
will print register values
|
|
@@ -309,58 +240,57 @@ Here is a gist of methods you can access from `p`:
|
|
|
309
240
|
override=True
|
|
310
241
|
override previous break point at same location
|
|
311
242
|
```
|
|
243
|
+
|
|
312
244
|
- `show_current_source`
|
|
313
|
-
|
|
245
|
+
- print current source code if possible
|
|
314
246
|
- `finish`
|
|
315
|
-
|
|
247
|
+
- Run current frame till its end.
|
|
316
248
|
- `step_into`
|
|
317
|
-
|
|
249
|
+
- Step into current instruction.
|
|
318
250
|
- `step_over`
|
|
319
|
-
|
|
251
|
+
- Step over current instruction.
|
|
320
252
|
- `remove_all_hilda_breakpoints`
|
|
321
|
-
|
|
253
|
+
- Remove all breakpoints created by Hilda
|
|
322
254
|
- `remove_hilda_breakpoint`
|
|
323
|
-
|
|
255
|
+
- Remove a single breakpoint placed by Hilda
|
|
324
256
|
- `force_return`
|
|
325
|
-
|
|
257
|
+
- Prematurely return from a stack frame, short-circuiting exection of newer frames and optionally
|
|
326
258
|
yielding a specified value.
|
|
327
259
|
- `proc_info`
|
|
328
|
-
|
|
260
|
+
- Print information about currently running mapped process.
|
|
329
261
|
- `print_proc_entitlements`
|
|
330
|
-
|
|
262
|
+
- Get the plist embedded inside the process' __LINKEDIT section.
|
|
331
263
|
- `bp`
|
|
332
|
-
|
|
264
|
+
- Add a breakpoint
|
|
333
265
|
- `show_hilda_breakpoints`
|
|
334
|
-
|
|
335
|
-
- `show_commands`
|
|
336
|
-
- Show available commands.
|
|
266
|
+
- Show existing breakpoints created by Hilda.
|
|
337
267
|
- `save`
|
|
338
|
-
|
|
268
|
+
- Save loaded symbols map (for loading later using the load() command)
|
|
339
269
|
- `load`
|
|
340
|
-
|
|
270
|
+
- Load an existing symbols map (previously saved by the save() command)
|
|
341
271
|
- `po`
|
|
342
|
-
|
|
272
|
+
- Print given object using LLDB's po command
|
|
343
273
|
Can also run big chunks of native code:
|
|
344
274
|
|
|
345
275
|
po('NSMutableString *s = [NSMutableString string]; [s appendString:@"abc"]; [s description]')
|
|
346
276
|
- `globalize_symbols`
|
|
347
|
-
|
|
277
|
+
- Make all symbols in python's global scope
|
|
348
278
|
- `jump`
|
|
349
|
-
|
|
279
|
+
- jump to given symbol
|
|
350
280
|
- `lldb_handle_command`
|
|
351
|
-
|
|
281
|
+
- Execute an LLDB command
|
|
352
282
|
For example:
|
|
353
283
|
lldb_handle_command('register read')
|
|
354
284
|
- `objc_get_class`
|
|
355
|
-
|
|
285
|
+
- Get ObjC class object
|
|
356
286
|
- `CFSTR`
|
|
357
|
-
|
|
287
|
+
- Create CFStringRef object from given string
|
|
358
288
|
- `ns`
|
|
359
|
-
|
|
289
|
+
- Create NSObject from given data
|
|
360
290
|
- `from_ns`
|
|
361
|
-
|
|
291
|
+
- Create python object from NS object.
|
|
362
292
|
- `evaluate_expression`
|
|
363
|
-
|
|
293
|
+
- Wrapper for LLDB's EvaluateExpression.
|
|
364
294
|
Used for quick code snippets.
|
|
365
295
|
|
|
366
296
|
Feel free to use local variables inside the expression using format string.
|
|
@@ -368,35 +298,37 @@ Here is a gist of methods you can access from `p`:
|
|
|
368
298
|
currentDevice = objc_get_class('UIDevice').currentDevice
|
|
369
299
|
evaluate_expression(f'[[{currentDevice} systemName] hasPrefix:@"2"]')
|
|
370
300
|
- `import_module`
|
|
371
|
-
|
|
301
|
+
- Import & reload given python module (intended mainly for external snippets)
|
|
372
302
|
- `unwind`
|
|
373
|
-
|
|
303
|
+
- Unwind the stack (useful when get_evaluation_unwind() == False)
|
|
374
304
|
- `set_selected_thread`
|
|
375
|
-
|
|
305
|
+
- sets the currently selected thread, which is used in other parts of the program, such as displaying disassembly or
|
|
376
306
|
checking registers.
|
|
377
307
|
This ensures the application focuses on the specified thread for these operations.
|
|
378
308
|
|
|
379
|
-
|
|
309
|
+
All these methods are available from the global `p` within the newly created IPython shell. In addition, you may invoke any of the exported APIs described in the [Python API](#python-api)
|
|
380
310
|
|
|
381
|
-
|
|
311
|
+
#### Magic functions
|
|
312
|
+
|
|
313
|
+
Sometimes accessing the [Python API](#python-api) can be tiring, so we added some magic functions to help you out!
|
|
382
314
|
|
|
383
315
|
- `%objc <className>`
|
|
384
|
-
|
|
316
|
+
- Equivalent to: `className = p.objc_get_class(className)`
|
|
385
317
|
- `%fbp <filename> <addressInHex>`
|
|
386
|
-
|
|
318
|
+
- Equivalent to: `p.file_symbol(addressInHex, filename).bp()`
|
|
387
319
|
|
|
388
|
-
|
|
320
|
+
#### Key-bindings
|
|
389
321
|
|
|
390
322
|
- **F7**: Step Into
|
|
391
323
|
- **F8**: Step Over
|
|
392
324
|
- **F9**: Continue
|
|
393
325
|
- **F10**: Stop
|
|
394
326
|
|
|
395
|
-
|
|
327
|
+
#### Configurables
|
|
396
328
|
|
|
397
329
|
The global `cfg` used to configure various settings for evaluation and monitoring.
|
|
398
330
|
|
|
399
|
-
|
|
331
|
+
These settings include:
|
|
400
332
|
|
|
401
333
|
- `evaluation_unwind_on_error`: Whether to unwind on error during evaluation. (Default: `False`)
|
|
402
334
|
- `evaluation_ignore_breakpoints`: Whether to ignore breakpoints during evaluation. (Default: `False`)
|
|
@@ -405,15 +337,9 @@ The global `cfg` used to configure various settings for evaluation and monitorin
|
|
|
405
337
|
- `objc_verbose_monitor`: When set to `True`, using `monitor()` will automatically print Objective-C method arguments. (
|
|
406
338
|
Default: `False`)
|
|
407
339
|
|
|
408
|
-
|
|
340
|
+
#### UI Configuration
|
|
409
341
|
|
|
410
|
-
|
|
411
|
-
cfg.objc_verbose_monitor = True
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
## UI Configuration
|
|
415
|
-
|
|
416
|
-
Hilda contains minimal UI for examining the target state.
|
|
342
|
+
Hilda contains a minimal UI for examining the target state.
|
|
417
343
|
The UI is divided into views:
|
|
418
344
|
|
|
419
345
|
- Registers
|
|
@@ -470,7 +396,31 @@ ui.colors.address = 'red'
|
|
|
470
396
|
ui.color.title = 'green'
|
|
471
397
|
```
|
|
472
398
|
|
|
473
|
-
|
|
399
|
+
### Python API
|
|
400
|
+
|
|
401
|
+
Hilda provides a comprehensive API wrappers to access LLDB capabilities.
|
|
402
|
+
This API may be used to access process memory, trigger functions, place breakpoints and much more!
|
|
403
|
+
|
|
404
|
+
Also, in addition to access this API using the [Hilda shell](#inside-a-hilda-shell), you may also use pure-python script using any of the `create_hilda_client_using_*` APIs.
|
|
405
|
+
|
|
406
|
+
Consider the following snippet as an example of such usage:
|
|
407
|
+
|
|
408
|
+
```python
|
|
409
|
+
from hilda.launch_lldb import create_hilda_client_using_attach_by_name
|
|
410
|
+
|
|
411
|
+
# attach to `sysmond`
|
|
412
|
+
p = create_hilda_client_using_attach_by_name('sysmond')
|
|
413
|
+
|
|
414
|
+
# allocate 10 bytes and print their address
|
|
415
|
+
print(p.symbols.malloc(10))
|
|
416
|
+
|
|
417
|
+
# detach
|
|
418
|
+
p.detach()
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Please note this script must be executed using `xcrun python3` in order for it to be able to access LLDB API.
|
|
422
|
+
|
|
423
|
+
#### Symbol objects
|
|
474
424
|
|
|
475
425
|
In Hilda, almost everything is wrapped using the `Symbol` Object. Symbol is just a nicer way for referring to addresses
|
|
476
426
|
encapsulated with an object allowing to deref the memory inside, or use these addresses as functions.
|
|
@@ -577,7 +527,7 @@ p.bp('symbol_name')
|
|
|
577
527
|
p.bp('symbol_name', module_name='ModuleName')
|
|
578
528
|
```
|
|
579
529
|
|
|
580
|
-
|
|
530
|
+
#### Globalized symbols
|
|
581
531
|
|
|
582
532
|
Usually you would want/need to use the symbols already mapped into the currently running process. To do so, you can
|
|
583
533
|
access them using `symbols.<symbol-name>`. The `symbols` global object is of type `SymbolsJar`, which is a wrapper
|
|
@@ -622,7 +572,7 @@ jar = jar.code()
|
|
|
622
572
|
jar.monitor(regs={'x0': 'x'}, bt=True)
|
|
623
573
|
```
|
|
624
574
|
|
|
625
|
-
|
|
575
|
+
#### Objective-C Classes
|
|
626
576
|
|
|
627
577
|
The same as symbols applies to Objective-C classes name resolution. You can either:
|
|
628
578
|
|
|
@@ -675,7 +625,7 @@ dictionary = NSDictionary.capture_self(True)
|
|
|
675
625
|
dictionary.show()
|
|
676
626
|
```
|
|
677
627
|
|
|
678
|
-
|
|
628
|
+
#### Objective-C Objects
|
|
679
629
|
|
|
680
630
|
In order to work with ObjC objects, each symbol contains a property called
|
|
681
631
|
`objc_symbol`. After calling, you can work better with each object:
|
|
@@ -741,7 +691,7 @@ abc_string = p.evaluate_expression('[NSString stringWithFormat:@"abc"]')
|
|
|
741
691
|
print(abc_string.po())
|
|
742
692
|
```
|
|
743
693
|
|
|
744
|
-
|
|
694
|
+
#### Using snippets
|
|
745
695
|
|
|
746
696
|
Snippets are extensions for normal functionality used as quick cookbooks for day-to-day tasks of a debugger.
|
|
747
697
|
|