hilda 3.0.1__tar.gz → 3.2.0__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-3.0.1 → hilda-3.2.0}/.github/workflows/python-app.yml +1 -1
- {hilda-3.0.1 → hilda-3.2.0}/PKG-INFO +107 -183
- {hilda-3.0.1 → hilda-3.2.0}/README.md +104 -181
- {hilda-3.0.1 → hilda-3.2.0}/hilda/_version.py +2 -2
- {hilda-3.0.1 → hilda-3.2.0}/hilda/breakpoints.py +29 -5
- hilda-3.2.0/hilda/decorators.py +45 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/exceptions.py +1 -6
- {hilda-3.0.1 → hilda-3.2.0}/hilda/hilda_client.py +17 -65
- {hilda-3.0.1 → hilda-3.2.0}/hilda/ipython_extensions/events.py +13 -17
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c_class.py +86 -29
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c_symbol.py +5 -16
- {hilda-3.0.1 → hilda-3.2.0}/hilda/symbol.py +47 -12
- hilda-3.2.0/hilda/symbols.py +579 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/watchpoints.py +41 -9
- {hilda-3.0.1 → hilda-3.2.0}/hilda.egg-info/PKG-INFO +107 -183
- {hilda-3.0.1 → hilda-3.2.0}/hilda.egg-info/SOURCES.txt +3 -4
- {hilda-3.0.1 → hilda-3.2.0}/tests/conftest.py +1 -1
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_symbols/test_objective_c_symbol.py +1 -1
- hilda-3.2.0/tests/test_symbols/test_symbol_list.py +142 -0
- hilda-3.0.1/hilda/hilda_ascii_art.html +0 -40
- hilda-3.0.1/hilda/symbols_jar.py +0 -208
- hilda-3.0.1/tests/test_hilda_client/test_rebind_symbols.py +0 -6
- hilda-3.0.1/tests/test_symbols/test_symbols_jar.py +0 -38
- {hilda-3.0.1 → hilda-3.2.0}/.github/workflows/python-publish.yml +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/.gitignore +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/.pre-commit-config.yaml +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/LICENSE +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/gifs/.gitattributes +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/gifs/ui.png +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/gifs/xpc_print_message.gif +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/__init__.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/__main__.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/cli.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/common.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/ipython_extensions/keybindings.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/ipython_extensions/magics.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/launch_lldb.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/lldb_entrypoint.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/lldb_importer.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c/from_ns_to_json.m +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c/get_objectivec_class_by_module.m +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c/get_objectivec_class_description.m +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c/get_objectivec_symbol_data.m +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c/lsof.m +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/objective_c/to_ns_from_json.m +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/registers.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/__init__.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/boringssl.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/collections.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/dyld.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/fs_utils.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/libmalloc.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/mach/CFRunLoopServiceMachPort_hooks.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/mach/__init__.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/macho/__init__.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/macho/all_image_infos.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/macho/apple_version.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/macho/image_info.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/macho/macho.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/macho/macho_load_commands.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/remotepairingd.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/syslog.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/uuid.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/snippets/xpc.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/ui/colors.json +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/ui/ui_manager.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda/ui/views.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda.egg-info/dependency_links.txt +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda.egg-info/entry_points.txt +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda.egg-info/requires.txt +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/hilda.egg-info/top_level.txt +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/pyproject.toml +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/requirements.txt +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/setup.cfg +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/__init__.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_hilda_client/test_from_ns.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_hilda_client/test_hilda_client.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_hilda_client/test_monitor.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_hilda_client/test_ns.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_hilda_client/test_registers.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_snippets/test_xpc.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_symbols/test_objective_c_class.py +0 -0
- {hilda-3.0.1 → hilda-3.2.0}/tests/test_symbols/test_symbol.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: hilda
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.2.0
|
|
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,6 +55,7 @@ Requires-Dist: inquirer3
|
|
|
55
55
|
Requires-Dist: traitlets
|
|
56
56
|
Provides-Extra: test
|
|
57
57
|
Requires-Dist: pytest; extra == "test"
|
|
58
|
+
Dynamic: license-file
|
|
58
59
|
|
|
59
60
|
# Hilda
|
|
60
61
|
|
|
@@ -128,7 +129,7 @@ You can may start a Hilda interactive shell by invoking any of the subcommand:
|
|
|
128
129
|
- `hilda attach [-p pid] [-n process-name]`
|
|
129
130
|
- Attach to an already running process on current host (specified by either `pid` or `process-name`)
|
|
130
131
|
- `hilda remote HOSTNAME PORT`
|
|
131
|
-
- Attach to an already running process on a target host (
|
|
132
|
+
- Attach to an already running process on a target host (specified by `HOSTNAME PORT`)
|
|
132
133
|
- `hilda bare`
|
|
133
134
|
- Only start an LLDB shell and load Hilda as a plugin.
|
|
134
135
|
- Please refer to the following help page if you require help on the command available to you within the lldb shell:
|
|
@@ -144,173 +145,101 @@ You can may start a Hilda interactive shell by invoking any of the subcommand:
|
|
|
144
145
|
... and attaching to a local process:
|
|
145
146
|
|
|
146
147
|
```shell
|
|
147
|
-
process attach -n
|
|
148
|
-
process attach -p
|
|
148
|
+
process attach -n process_name
|
|
149
|
+
process attach -p process_pid
|
|
149
150
|
```
|
|
150
151
|
|
|
151
152
|
When you are ready, just execute `hilda` to move to Hilda's iPython shell.
|
|
152
153
|
|
|
153
154
|
### Inside a Hilda shell
|
|
154
155
|
|
|
155
|
-
Upon starting Hilda
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- `
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
- `
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- `
|
|
176
|
-
|
|
177
|
-
- `
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
- `
|
|
184
|
-
|
|
185
|
-
- `peek`
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
- `
|
|
194
|
-
|
|
195
|
-
- `
|
|
196
|
-
|
|
197
|
-
- `
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
- `
|
|
204
|
-
|
|
205
|
-
- `
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
- `
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
force_return=value
|
|
243
|
-
force a return from function with the specified value
|
|
244
|
-
name=some_value
|
|
245
|
-
use `some_name` instead of the symbol name automatically extracted from the calling frame
|
|
246
|
-
override=True
|
|
247
|
-
override previous break point at same location
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
- `show_current_source`
|
|
251
|
-
- print current source code if possible
|
|
252
|
-
- `finish`
|
|
253
|
-
- Run current frame till its end.
|
|
254
|
-
- `step_into`
|
|
255
|
-
- Step into current instruction.
|
|
256
|
-
- `step_over`
|
|
257
|
-
- Step over current instruction.
|
|
258
|
-
- `breakpoints.clear`
|
|
259
|
-
- Remove all breakpoints
|
|
260
|
-
- `breakpoints.remove`
|
|
261
|
-
- Remove a single breakpoint
|
|
262
|
-
- `force_return`
|
|
263
|
-
- Prematurely return from a stack frame, short-circuiting exection of newer frames and optionally
|
|
264
|
-
yielding a specified value.
|
|
265
|
-
- `proc_info`
|
|
266
|
-
- Print information about currently running mapped process.
|
|
267
|
-
- `print_proc_entitlements`
|
|
268
|
-
- Get the plist embedded inside the process' __LINKEDIT section.
|
|
269
|
-
- `bp` or `breakpoints.add`
|
|
270
|
-
- Add a breakpoint
|
|
271
|
-
- `breakpoints.show`
|
|
272
|
-
- Show existing breakpoints
|
|
273
|
-
- `po`
|
|
274
|
-
- Print given object using LLDB's po command
|
|
275
|
-
Can also run big chunks of native code:
|
|
276
|
-
|
|
277
|
-
po('NSMutableString *s = [NSMutableString string]; [s appendString:@"abc"]; [s description]')
|
|
278
|
-
- `globalize_symbols`
|
|
279
|
-
- Make all symbols in python's global scope
|
|
280
|
-
- `jump`
|
|
281
|
-
- jump to given symbol
|
|
282
|
-
- `lldb_handle_command`
|
|
283
|
-
- Execute an LLDB command
|
|
284
|
-
For example:
|
|
285
|
-
lldb_handle_command('register read')
|
|
286
|
-
- `objc_get_class`
|
|
287
|
-
- Get ObjC class object
|
|
288
|
-
- `CFSTR`
|
|
289
|
-
- Create CFStringRef object from given string
|
|
290
|
-
- `ns`
|
|
291
|
-
- Create NSObject from given data
|
|
292
|
-
- `from_ns`
|
|
293
|
-
- Create python object from NS object.
|
|
294
|
-
- `evaluate_expression`
|
|
295
|
-
- Wrapper for LLDB's EvaluateExpression.
|
|
296
|
-
Used for quick code snippets.
|
|
297
|
-
|
|
298
|
-
Feel free to use local variables inside the expression using format string.
|
|
299
|
-
For example:
|
|
300
|
-
currentDevice = objc_get_class('UIDevice').currentDevice
|
|
301
|
-
evaluate_expression(f'[[{currentDevice} systemName] hasPrefix:@"2"]')
|
|
302
|
-
- `import_module`
|
|
303
|
-
- Import & reload given python module (intended mainly for external snippets)
|
|
304
|
-
- `unwind`
|
|
305
|
-
- Unwind the stack (useful when get_evaluation_unwind() == False)
|
|
306
|
-
- `set_selected_thread`
|
|
307
|
-
- sets the currently selected thread, which is used in other parts of the program, such as displaying disassembly or
|
|
308
|
-
checking registers.
|
|
309
|
-
This ensures the application focuses on the specified thread for these operations.
|
|
310
|
-
- `wait_for_module`
|
|
311
|
-
- Wait for a module to be loaded (`dlopen`) by checking if given expression is contained within its filename
|
|
312
|
-
|
|
313
|
-
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)
|
|
156
|
+
Upon starting Hilda, you are welcomed into an IPython shell.
|
|
157
|
+
You can access following methods via the variable `p`.
|
|
158
|
+
|
|
159
|
+
Basic flow control:
|
|
160
|
+
|
|
161
|
+
- `stop` - Stop process
|
|
162
|
+
- `cont` - Continue process
|
|
163
|
+
- `finish` - Run current function until return
|
|
164
|
+
- `step_into` - Step into current instruction
|
|
165
|
+
- `step_over` - Step over current instruction.
|
|
166
|
+
- `run_for` - Run the process for given interval
|
|
167
|
+
- `force_return` - Prematurely return from a stack frame, short-circuiting execution of inner
|
|
168
|
+
frames and optionally yielding a specified value.
|
|
169
|
+
- `jump` - Jump to given symbol
|
|
170
|
+
- `wait_for_module` - Wait for a module to be loaded (`dlopen`) by checking if given expression is contained within its filename
|
|
171
|
+
- `detach` - Detach from process (useful for exiting gracefully so the
|
|
172
|
+
process doesn't get killed when you exit)
|
|
173
|
+
|
|
174
|
+
Breakpoints:
|
|
175
|
+
- `bp` or `breakpoints.add` - Add a breakpoint
|
|
176
|
+
- `breakpoints.show` - Show existing breakpoints
|
|
177
|
+
- `breakpoints.remove` - Remove a single breakpoint
|
|
178
|
+
- `breakpoints.clear` - Remove all breakpoints
|
|
179
|
+
- `monitor` or `breakpoints.add_monitor` - Creates a breakpoint whose callback implements the requested features (print register values, execute commands, mock return value, etc.)
|
|
180
|
+
|
|
181
|
+
Basic read/write:
|
|
182
|
+
|
|
183
|
+
- `get_register` - Get register value
|
|
184
|
+
- `set_register` - Set register value
|
|
185
|
+
- `poke` - Write data at address
|
|
186
|
+
- `peek[_str,_std_str]` - Read buffer/C-string/`std::string` at address
|
|
187
|
+
- `po` - Print object using LLDB's `po` command
|
|
188
|
+
Can also run arbitrary native code:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
p.po('NSMutableString *s = [NSMutableString string]; [s appendString:@"abc"]; [s description]')
|
|
192
|
+
```
|
|
193
|
+
- `disass` - Print disassembly at address
|
|
194
|
+
- `show_current_source` - Print current source code (if possible)
|
|
195
|
+
- `bt` - Get backtrace
|
|
196
|
+
- `lsof` - Get all open FDs
|
|
197
|
+
- `hd` - Hexdump a buffer
|
|
198
|
+
- `proc_info` - Print information about currently running mapped process
|
|
199
|
+
- `print_proc_entitlements` - Get the plist embedded inside the process' __LINKEDIT section.
|
|
200
|
+
|
|
201
|
+
Execute code:
|
|
202
|
+
|
|
203
|
+
- `call` - Call function at given address with given parameters
|
|
204
|
+
- `objc_call` - Simulate a call to an objc selector
|
|
205
|
+
- `inject` - Inject a single library into currently running process
|
|
206
|
+
- `disable_jetsam_memory_checks` -
|
|
207
|
+
Disable jetsam memory checks (to prevent raising
|
|
208
|
+
`error: Execution was interrupted, reason: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=15 MB, unused=0x0).`
|
|
209
|
+
when evaluating expressions).
|
|
210
|
+
|
|
211
|
+
Hilda symbols:
|
|
212
|
+
|
|
213
|
+
- `symbol` - Get symbol object for a given address
|
|
214
|
+
- `objc_symbol` - Get objc symbol wrapper for given address
|
|
215
|
+
- `file_symbol` - Calculate symbol address without ASLR
|
|
216
|
+
- `save` - Save loaded symbols map (for loading later using the load() command)
|
|
217
|
+
- `load` - Load an existing symbols map (previously saved by the save() command)
|
|
218
|
+
- `globalize_symbols` - Make all symbols in python's global scope
|
|
219
|
+
|
|
220
|
+
Advanced:
|
|
221
|
+
|
|
222
|
+
- `lldb_handle_command` - Execute an LLDB command (e.g., `p.lldb_handle_command('register read')`)
|
|
223
|
+
- `evaluate_expression` - Use for quick code snippets (wrapper for LLDB's `EvaluateExpression`)
|
|
224
|
+
|
|
225
|
+
Take advantage of local variables inside the expression using format string, e.g.,
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
currentDevice = p.objc_get_class('UIDevice').currentDevice
|
|
229
|
+
p.evaluate_expression(f'[[{currentDevice} systemName] hasPrefix:@"2"]')
|
|
230
|
+
```
|
|
231
|
+
- `import_module` - Import & reload given python module (intended mainly for external snippets)
|
|
232
|
+
- `unwind` - Unwind the stack (useful when get_evaluation_unwind() == False)
|
|
233
|
+
- `set_selected_thread` - sets the currently selected thread, which is used in other parts of the program, such as displaying disassembly or
|
|
234
|
+
checking registers.
|
|
235
|
+
This ensures the application focuses on the specified thread for these operations.
|
|
236
|
+
|
|
237
|
+
Objective-C related:
|
|
238
|
+
|
|
239
|
+
- `objc_get_class` - Get ObjC class object
|
|
240
|
+
- `CFSTR` - Create CFStringRef object from given string
|
|
241
|
+
- `ns` - Create NSObject from given data
|
|
242
|
+
- `from_ns` - Create python object from NS object.
|
|
314
243
|
|
|
315
244
|
#### Magic functions
|
|
316
245
|
|
|
@@ -363,7 +292,7 @@ ui.show()
|
|
|
363
292
|
```
|
|
364
293
|
|
|
365
294
|
By default `step_into` and `step_over` will show this UI automatically.
|
|
366
|
-
You may disable this
|
|
295
|
+
You may disable this behavior by executing:
|
|
367
296
|
|
|
368
297
|
```python
|
|
369
298
|
ui.active = False
|
|
@@ -487,7 +416,7 @@ s[0] = 1
|
|
|
487
416
|
s[0] = p.symbol(0x11223344)() # calling symbols also returns symbols
|
|
488
417
|
|
|
489
418
|
# attempt to resolve symbol's name
|
|
490
|
-
print(p.symbol(0x11223344).
|
|
419
|
+
print(p.symbol(0x11223344).lldb_address)
|
|
491
420
|
|
|
492
421
|
# monitor each time a symbol is called into console and print its backtrace (`bt` option)
|
|
493
422
|
# this will create a scripted breakpoint which prints your desired data and continue
|
|
@@ -537,8 +466,8 @@ p.bp(('symbol_name', 'ModuleName'))
|
|
|
537
466
|
#### Globalized symbols
|
|
538
467
|
|
|
539
468
|
Usually you would want/need to use the symbols already mapped into the currently running process. To do so, you can
|
|
540
|
-
access them using `symbols.<symbol-name>`. The `symbols` global object is of type `
|
|
541
|
-
|
|
469
|
+
access them using `symbols.<symbol-name>`. The `symbols` global object is of type `SymbolList`, which acts like
|
|
470
|
+
`dict` for accessing all exported symbols. For example, the following will generate a call to the exported
|
|
542
471
|
`malloc` function with `20` as its only argument:
|
|
543
472
|
|
|
544
473
|
```python
|
|
@@ -561,22 +490,17 @@ x = malloc(20)
|
|
|
561
490
|
Sometimes you don't really know where to start your research. All you have is just theories of how your desired exported
|
|
562
491
|
symbol should be called (if any).
|
|
563
492
|
|
|
564
|
-
For that reason alone, we have the `rebind_symbols()`
|
|
565
|
-
command - to help you find the symbol you are looking for.
|
|
566
|
-
|
|
567
493
|
```python
|
|
568
|
-
p.rebind_symbols() # this might take some time
|
|
569
|
-
|
|
570
494
|
# find all symbols prefixed as `mem*` AND don't have `cpy`
|
|
571
495
|
# in their name
|
|
572
|
-
|
|
496
|
+
l = p.symbols.filter_startswith('mem') - p.symbols.filter_name_contains('cpy')
|
|
573
497
|
|
|
574
498
|
# filter only symbols of type "code" (removing data global for example)
|
|
575
|
-
|
|
499
|
+
l = l.filter_code_symbols()
|
|
576
500
|
|
|
577
501
|
# monitor every time each one is called, print its `x0` in HEX
|
|
578
502
|
# form and show the backtrace
|
|
579
|
-
|
|
503
|
+
l.monitor(regs={'x0': 'x'}, bt=True)
|
|
580
504
|
```
|
|
581
505
|
|
|
582
506
|
#### Objective-C Classes
|
|
@@ -608,21 +532,21 @@ print(NSDictionary.ivars)
|
|
|
608
532
|
# show the class' methods
|
|
609
533
|
print(NSDictionary.methods)
|
|
610
534
|
|
|
611
|
-
# show the class'
|
|
535
|
+
# show the class' properties
|
|
612
536
|
print(NSDictionary.properties)
|
|
613
537
|
|
|
614
538
|
# view class' selectors which are prefixed with 'init'
|
|
615
|
-
print(NSDictionary.
|
|
539
|
+
print(NSDictionary.methods.filter_startswith('init'))
|
|
616
540
|
|
|
617
|
-
# you can of course use any of `
|
|
541
|
+
# you can of course use any of `SymbolList` over them, for example:
|
|
618
542
|
# this will `po` (print object) all those selectors returned value
|
|
619
|
-
NSDictionary.
|
|
543
|
+
NSDictionary.methods.filter_startswith('init').monitor(retval='po')
|
|
620
544
|
|
|
621
545
|
# monitor each time any selector in NSDictionary is called
|
|
622
546
|
NSDictionary.monitor()
|
|
623
547
|
|
|
624
548
|
# `force_return` for some specific selector with a hard-coded value (4)
|
|
625
|
-
NSDictionary.
|
|
549
|
+
NSDictionary.methods.get('valueForKey:').address.monitor(force_return=4)
|
|
626
550
|
|
|
627
551
|
# capture the `self` object at the first hit of any selector
|
|
628
552
|
# `True` for busy-wait for object to be captured
|
|
@@ -672,7 +596,7 @@ commands so you are able to use complicated types when parsing values and passin
|
|
|
672
596
|
import datetime
|
|
673
597
|
|
|
674
598
|
# using the `ns` command we can just pass a python-native dictionary
|
|
675
|
-
function_requiring_a_specfic_dictionary(
|
|
599
|
+
function_requiring_a_specfic_dictionary(p.cf({
|
|
676
600
|
'key1': 'string', # will convert to NSString
|
|
677
601
|
'key2': True, # will convert to NSNumber
|
|
678
602
|
'key3': b'1234', # will convert to NSData
|
|
@@ -707,7 +631,7 @@ They all use the following concept to use:
|
|
|
707
631
|
```python
|
|
708
632
|
from hilda.snippets import snippet_name
|
|
709
633
|
|
|
710
|
-
snippet_name.
|
|
634
|
+
snippet_name.do_something()
|
|
711
635
|
```
|
|
712
636
|
|
|
713
637
|
For example, XPC sniffing can be done using:
|