diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2015-12-16 18:42:48 +0100 |
|---|---|---|
| committer | serpilliere <serpilliere@users.noreply.github.com> | 2015-12-16 18:42:48 +0100 |
| commit | 4915549bfcb8c7a1870f51935337c6eb7c7cda29 (patch) | |
| tree | 9b6540b736f6163197fe8dd4ff066a27a638aff4 /example | |
| parent | b998b1a8b2814585692e885e656c48357fbbb9b8 (diff) | |
| parent | 797b00e9449368448518ffa5497935569049c3ba (diff) | |
| download | miasm-4915549bfcb8c7a1870f51935337c6eb7c7cda29.tar.gz miasm-4915549bfcb8c7a1870f51935337c6eb7c7cda29.zip | |
Merge pull request #295 from cea-sec/fix_virt_api
Update api according to Elfesteem
Diffstat (limited to '')
| -rw-r--r-- | example/asm/shellcode.py | 13 | ||||
| -rw-r--r-- | example/jitter/unpack_upx.py | 6 |
2 files changed, 12 insertions, 7 deletions
diff --git a/example/asm/shellcode.py b/example/asm/shellcode.py index 253386b5..9dc5c6bc 100644 --- a/example/asm/shellcode.py +++ b/example/asm/shellcode.py @@ -10,8 +10,8 @@ from miasm2.analysis.machine import Machine from miasm2.core.interval import interval parser = ArgumentParser("Multi-arch (32 bits) assembler") -parser.add_argument('architecture', help="architecture: " + \ - ",".join(Machine.available_machine())) +parser.add_argument('architecture', help="architecture: " + + ",".join(Machine.available_machine())) parser.add_argument("source", help="Source file to assemble") parser.add_argument("output", help="Output file") parser.add_argument("--PE", help="Create a PE with a few imports", @@ -96,8 +96,13 @@ if args.encrypt: patches = new_patches print patches -for offset, raw in patches.items(): - virt[offset] = raw +if isinstance(virt, StrPatchwork): + for offset, raw in patches.items(): + virt[offset] = raw +else: + for offset, raw in patches.items(): + virt.set(offset, raw) + # Produce output open(args.output, 'wb').write(str(output)) diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py index 58507506..72a9feb3 100644 --- a/example/jitter/unpack_upx.py +++ b/example/jitter/unpack_upx.py @@ -25,7 +25,8 @@ def kernel32_GetProcAddress(jitter): else jitter.get_str_ansi(args.fname)) logging.info(fname) - # Get the generated address of the library, and store it in memory to dst_ad + # Get the generated address of the library, and store it in memory to + # dst_ad ad = sb.libs.lib_get_add_func(args.libbase, fname, dst_ad) # Add a breakpoint in case of a call on the resolved function # NOTE: never happens in UPX, just for skeleton @@ -34,7 +35,6 @@ def kernel32_GetProcAddress(jitter): jitter.func_ret_stdcall(ret_ad, ad) - parser = Sandbox_Win_x86_32.parser(description="Generic UPX unpacker") parser.add_argument("filename", help="PE Filename") parser.add_argument('-v', "--verbose", @@ -86,7 +86,7 @@ def update_binary(jitter): logging.info('updating binary') for s in sb.pe.SHList: sdata = sb.jitter.vm.get_mem(sb.pe.rva2virt(s.addr), s.rawsize) - sb.pe.virt[sb.pe.rva2virt(s.addr)] = sdata + sb.pe.rva.set(s.addr, sdata) # Stop execution jitter.run = False |