diff options
| author | Camille Mougey <commial@gmail.com> | 2023-04-23 11:56:36 +0200 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2023-04-23 11:56:36 +0200 |
| commit | 17552f09b91acd44dbc03cce1d8d2f94c20af3d9 (patch) | |
| tree | 80fbd4b81a19b9ad17f8bf67ebc50feb34dda676 /example/symbol_exec/symbol_exec.py | |
| parent | 41f3c6aca4f7874d6a154ead2e16871f4948cc21 (diff) | |
| download | focaccia-miasm-17552f09b91acd44dbc03cce1d8d2f94c20af3d9.tar.gz focaccia-miasm-17552f09b91acd44dbc03cce1d8d2f94c20af3d9.zip | |
Example: add support for symbol name in `address`
Diffstat (limited to '')
| -rw-r--r-- | example/symbol_exec/symbol_exec.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/example/symbol_exec/symbol_exec.py b/example/symbol_exec/symbol_exec.py index 84418da5..1d3f4576 100644 --- a/example/symbol_exec/symbol_exec.py +++ b/example/symbol_exec/symbol_exec.py @@ -26,7 +26,16 @@ machine = Machine(cont.arch) mdis = machine.dis_engine(cont.bin_stream, loc_db=cont.loc_db) -addr = cont.entry_point if options.address is None else int(options.address, 0) +# no address -> entry point +# 0xXXXXXX -> use this address +# symbol -> resolve then use +if options.address is None: + addr = cont.entry_point +else: + try: + addr = int(options.address, 0) + except ValueError: + addr = loc_db.get_name_offset(options.address) asmcfg = mdis.dis_multiblock(addr) lifter = machine.lifter_model_call(mdis.loc_db) |