diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2017-04-06 14:36:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-06 14:36:01 +0200 |
| commit | 049abdc867f533ba270cbdfff839caefb9b162b9 (patch) | |
| tree | 419067643408bed0acc81529791f714150ddf644 /example/jitter/sandbox_call.py | |
| parent | b1ed94019554b25d4d8924594f8868318e8a8c4a (diff) | |
| parent | b535f6e26e354ca61307f8153b862385ba9d2a04 (diff) | |
| download | miasm-049abdc867f533ba270cbdfff839caefb9b162b9.tar.gz miasm-049abdc867f533ba270cbdfff839caefb9b162b9.zip | |
Merge pull request #515 from commial/feature/calling-conv-systemv
Feature/calling conv systemv
Diffstat (limited to 'example/jitter/sandbox_call.py')
| -rw-r--r-- | example/jitter/sandbox_call.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/example/jitter/sandbox_call.py b/example/jitter/sandbox_call.py new file mode 100644 index 00000000..49365004 --- /dev/null +++ b/example/jitter/sandbox_call.py @@ -0,0 +1,23 @@ +"""This example illustrate the Sandbox.call API, for direct call of a given +function""" + +from miasm2.analysis.sandbox import Sandbox_Linux_arml +from miasm2.analysis.binary import Container +from miasm2.os_dep.linux_stdlib import linobjs +from miasm2.core.utils import hexdump + +# Parse arguments +parser = Sandbox_Linux_arml.parser(description="ELF sandboxer") +parser.add_argument("filename", help="ELF Filename") +options = parser.parse_args() + +sb = Sandbox_Linux_arml(options.filename, options, globals()) + +with open(options.filename) as fdesc: + cont = Container.from_stream(fdesc) + addr_to_call = cont.symbol_pool.getby_name("md5_starts").offset + +# Calling md5_starts(malloc(0x64)) +addr = linobjs.heap.alloc(sb.jitter, 0x64) +sb.call(addr_to_call, addr) +hexdump(sb.jitter.vm.get_mem(addr, 0x64)) |