diff options
| author | Camille Mougey <commial@gmail.com> | 2019-03-07 14:37:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-07 14:37:07 +0100 |
| commit | 4c2320b46250a8d6f8774e1218544b72a154cd8e (patch) | |
| tree | b67e7b072439f84109bd39dad8ed7f3f135224f8 /test/jitter/test_post_instr.py | |
| parent | eab809932871f91d6f4aa770fc321af9e156e0f5 (diff) | |
| parent | 26c1075723a02984da6d3bc7423c5c0c43082dc3 (diff) | |
| download | miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.tar.gz miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.zip | |
Merge pull request #990 from serpilliere/support_python2_python3
Support python2 python3
Diffstat (limited to 'test/jitter/test_post_instr.py')
| -rw-r--r-- | test/jitter/test_post_instr.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/test/jitter/test_post_instr.py b/test/jitter/test_post_instr.py index 0aff667e..52274a46 100644 --- a/test/jitter/test_post_instr.py +++ b/test/jitter/test_post_instr.py @@ -1,27 +1,31 @@ +from __future__ import print_function import sys -from miasm2.analysis.machine import Machine -from miasm2.jitter.csts import PAGE_READ, PAGE_WRITE, EXCEPT_BREAKPOINT_MEMORY, EXCEPT_ACCESS_VIOL + +from miasm.core.utils import decode_hex +from miasm.analysis.machine import Machine +from miasm.jitter.csts import PAGE_READ, PAGE_WRITE, \ + EXCEPT_BREAKPOINT_MEMORY, EXCEPT_ACCESS_VIOL machine = Machine("x86_32") jitter = machine.jitter(sys.argv[1]) # Prepare stack and reset memory accesses to avoid an exception -jitter.vm.add_memory_page(0x10000, PAGE_READ|PAGE_WRITE, "\x00"*0x1000, "stack") -print jitter.vm +jitter.vm.add_memory_page(0x10000, PAGE_READ|PAGE_WRITE, b"\x00"*0x1000, "stack") +print(jitter.vm) jitter.cpu.ESP = 0x10000 + 0x1000 jitter.push_uint32_t(0x0) jitter.push_uint32_t(0x1337beef) jitter.vm.reset_memory_access() -print hex(jitter.vm.get_exception()) +print(hex(jitter.vm.get_exception())) # Add code, and keep memory write pending -jitter.vm.add_memory_page(0x1000, PAGE_READ|PAGE_WRITE, "\x00"*0x1000, "code page") +jitter.vm.add_memory_page(0x1000, PAGE_READ|PAGE_WRITE, b"\x00"*0x1000, "code page") # MOV EAX, 0x11223344 # RET -jitter.vm.set_mem(0x1000, "B844332211C3".decode('hex')) +jitter.vm.set_mem(0x1000, decode_hex("B844332211C3")) jitter.set_trace_log() |