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