diff options
Diffstat (limited to 'miasm2')
| -rw-r--r-- | miasm2/analysis/binary.py | 6 | ||||
| -rw-r--r-- | miasm2/analysis/debugging.py | 14 | ||||
| -rw-r--r-- | miasm2/analysis/gdbserver.py | 4 | ||||
| -rw-r--r-- | miasm2/analysis/sandbox.py | 16 | ||||
| -rw-r--r-- | miasm2/arch/arm/jit.py | 14 | ||||
| -rw-r--r-- | miasm2/arch/mips32/jit.py | 10 | ||||
| -rw-r--r-- | miasm2/arch/msp430/jit.py | 20 | ||||
| -rw-r--r-- | miasm2/arch/x86/jit.py | 38 | ||||
| -rw-r--r-- | miasm2/jitter/arch/JitCore_arm.c | 12 | ||||
| -rw-r--r-- | miasm2/jitter/arch/JitCore_mips32.c | 12 | ||||
| -rw-r--r-- | miasm2/jitter/arch/JitCore_msp430.c | 12 | ||||
| -rw-r--r-- | miasm2/jitter/arch/JitCore_x86.c | 16 | ||||
| -rw-r--r-- | miasm2/jitter/jitcore.py | 10 | ||||
| -rw-r--r-- | miasm2/jitter/jitcore_python.py | 10 | ||||
| -rw-r--r-- | miasm2/jitter/jitload.py | 60 | ||||
| -rw-r--r-- | miasm2/jitter/os_dep/linux_stdlib.py | 10 | ||||
| -rw-r--r-- | miasm2/jitter/os_dep/win_api_x86_32.py | 284 | ||||
| -rw-r--r-- | miasm2/jitter/os_dep/win_api_x86_32_seh.py | 96 | ||||
| -rw-r--r-- | miasm2/jitter/vm_mngr_py.c | 52 |
19 files changed, 348 insertions, 348 deletions
diff --git a/miasm2/analysis/binary.py b/miasm2/analysis/binary.py index c14078e3..77f1610d 100644 --- a/miasm2/analysis/binary.py +++ b/miasm2/analysis/binary.py @@ -41,8 +41,8 @@ class Container(object): if vm is not None: if addr is None: raise ValueError('set load addr') - vm.vm_add_memory_page(addr, - PAGE_READ, - data) + vm.add_memory_page(addr, + PAGE_READ, + data) self.e, self.bs, self.ep = e, bs, ep diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py index 82710b6a..bc422954 100644 --- a/miasm2/analysis/debugging.py +++ b/miasm2/analysis/debugging.py @@ -85,7 +85,7 @@ class Debugguer(object): write=write) dbm = DebugBreakpointMemory(addr, size, access_type) self.hw_bp_list.append(dbm) - self.myjit.vm.vm_add_memory_breakpoint(addr, size, access_type) + self.myjit.vm.add_memory_breakpoint(addr, size, access_type) def remove_breakpoint(self, dbs): "remove the DebugBreakpointSoft instance" @@ -100,7 +100,7 @@ class Debugguer(object): def remove_memory_breakpoint(self, dbm): "remove the DebugBreakpointMemory instance" self.hw_bp_list.remove(dbm) - self.myjit.vm.vm_remove_memory_breakpoint(dbm.addr, dbm.access_type) + self.myjit.vm.remove_memory_breakpoint(dbm.addr, dbm.access_type) def remove_memory_breakpoint_by_addr_access(self, addr, read=False, write=False): @@ -140,8 +140,8 @@ class Debugguer(object): print "Memory breakpoint reached!" # Remove flag - except_flag = self.myjit.vm.vm_get_exception() - self.myjit.vm.vm_set_exception(except_flag ^ res.except_flag) + except_flag = self.myjit.vm.get_exception() + self.myjit.vm.set_exception(except_flag ^ res.except_flag) else: raise NotImplementedError("Unknown Except") @@ -170,11 +170,11 @@ class Debugguer(object): def get_mem(self, addr, size=0xF): "hexdump @addr, size" - hexdump(self.myjit.vm.vm_get_mem(addr, size)) + hexdump(self.myjit.vm.get_mem(addr, size)) def get_mem_raw(self, addr, size=0xF): "hexdump @addr, size" - return self.myjit.vm.vm_get_mem(addr, size) + return self.myjit.vm.get_mem(addr, size) def watch_mem(self, addr, size=0xF): self.mem_watched.append((addr, size)) @@ -197,7 +197,7 @@ class Debugguer(object): def get_gpreg_all(self): "Return general purposes registers" - return self.myjit.cpu.vm_get_gpreg() + return self.myjit.cpu.get_gpreg() class DebugCmd(cmd.Cmd, object): diff --git a/miasm2/analysis/gdbserver.py b/miasm2/analysis/gdbserver.py index 507b2f67..73757a63 100644 --- a/miasm2/analysis/gdbserver.py +++ b/miasm2/analysis/gdbserver.py @@ -311,11 +311,11 @@ class GdbServer(object): return self.dbg.get_reg_value(reg_name) def read_memory(self, addr, size): - except_flag_vm = self.dbg.myjit.vm.vm_get_exception() + except_flag_vm = self.dbg.myjit.vm.get_exception() try: return self.dbg.get_mem_raw(addr, size).encode("hex") except RuntimeError: - self.dbg.myjit.vm.vm_set_exception(except_flag_vm) + self.dbg.myjit.vm.set_exception(except_flag_vm) return "00" * size diff --git a/miasm2/analysis/sandbox.py b/miasm2/analysis/sandbox.py index 598f40a0..2e569e61 100644 --- a/miasm2/analysis/sandbox.py +++ b/miasm2/analysis/sandbox.py @@ -257,10 +257,10 @@ class Sandbox_Win_x86_32(Sandbox, Arch_x86_32, OS_Win): Sandbox.__init__(self, *args, **kwargs) # Pre-stack some arguments - self.jitter.vm_push_uint32_t(2) - self.jitter.vm_push_uint32_t(1) - self.jitter.vm_push_uint32_t(0) - self.jitter.vm_push_uint32_t(0x1337beef) + self.jitter.push_uint32_t(2) + self.jitter.push_uint32_t(1) + self.jitter.push_uint32_t(0) + self.jitter.push_uint32_t(0x1337beef) # Set the runtime guard self.jitter.add_breakpoint(0x1337beef, self.__class__.code_sentinelle) @@ -287,10 +287,10 @@ class Sandbox_Linux_x86_32(Sandbox, Arch_x86_32, OS_Linux): Sandbox.__init__(self, *args, **kwargs) # Pre-stack some arguments - self.jitter.vm_push_uint32_t(2) - self.jitter.vm_push_uint32_t(1) - self.jitter.vm_push_uint32_t(0) - self.jitter.vm_push_uint32_t(0x1337beef) + self.jitter.push_uint32_t(2) + self.jitter.push_uint32_t(1) + self.jitter.push_uint32_t(0) + self.jitter.push_uint32_t(0x1337beef) # Set the runtime guard self.jitter.add_breakpoint(0x1337beef, self.__class__.code_sentinelle) diff --git a/miasm2/arch/arm/jit.py b/miasm2/arch/arm/jit.py index c2c21924..b9c3a1b2 100644 --- a/miasm2/arch/arm/jit.py +++ b/miasm2/arch/arm/jit.py @@ -18,17 +18,17 @@ class jitter_arm(jitter): jitter.__init__(self, ir_arm(sp), *args, **kwargs) self.ir_arch.jit_pc = self.ir_arch.arch.regs.PC - def vm_push_uint32_t(self, v): + def push_uint32_t(self, v): self.cpu.SP -= 4 - self.vm.vm_set_mem(self.cpu.SP, pck32(v)) + self.vm.set_mem(self.cpu.SP, pck32(v)) - def vm_pop_uint32_t(self): - x = upck32(self.vm.vm_get_mem(self.cpu.SP, 4)) + def pop_uint32_t(self): + x = upck32(self.vm.get_mem(self.cpu.SP, 4)) self.cpu.SP += 4 return x def get_stack_arg(self, n): - x = upck32(self.vm.vm_get_mem(self.cpu.SP + 4 * n, 4)) + x = upck32(self.vm.get_mem(self.cpu.SP + 4 * n, 4)) return x # calling conventions @@ -36,7 +36,7 @@ class jitter_arm(jitter): def func_args_stdcall(self, n_args): args = [] for i in xrange(min(n_args, 4)): - args.append(self.cpu.vm_get_gpreg()['R%d' % i]) + args.append(self.cpu.get_gpreg()['R%d' % i]) for i in xrange(max(0, n_args - 4)): args.append(self.get_stack_arg(i)) @@ -52,7 +52,7 @@ class jitter_arm(jitter): def get_arg_n_stdcall(self, n): if n < 4: - arg = self.cpu.vm_get_gpreg()['R%d' % n] + arg = self.cpu.get_gpreg()['R%d' % n] else: arg = self.get_stack_arg(n-4) return arg diff --git a/miasm2/arch/mips32/jit.py b/miasm2/arch/mips32/jit.py index 132e5da5..61fa8a5a 100644 --- a/miasm2/arch/mips32/jit.py +++ b/miasm2/arch/mips32/jit.py @@ -19,17 +19,17 @@ class jitter_mips32(jitter): self.ir_arch.jit_pc = self.ir_arch.arch.regs.PC self.ir_arch.attrib = 'l' - def vm_push_uint32_t(self, v): + def push_uint32_t(self, v): self.cpu.SP -= 4 - self.vm.vm_set_mem(self.cpu.SP, pck32(v)) + self.vm.set_mem(self.cpu.SP, pck32(v)) - def vm_pop_uint32_t(self): - x = upck32(self.vm.vm_get_mem(self.cpu.SP, 4)) + def pop_uint32_t(self): + x = upck32(self.vm.get_mem(self.cpu.SP, 4)) self.cpu.SP += 4 return x def get_stack_arg(self, n): - x = upck32(self.vm.vm_get_mem(self.cpu.SP + 4 * n, 4)) + x = upck32(self.vm.get_mem(self.cpu.SP + 4 * n, 4)) return x def init_run(self, *args, **kwargs): diff --git a/miasm2/arch/msp430/jit.py b/miasm2/arch/msp430/jit.py index 711011bc..008a3036 100644 --- a/miasm2/arch/msp430/jit.py +++ b/miasm2/arch/msp430/jit.py @@ -19,22 +19,22 @@ class jitter_msp430(jitter): jitter.__init__(self, ir_msp430(sp), *args, **kwargs) self.ir_arch.jit_pc = self.ir_arch.arch.regs.PC - def vm_push_uint16_t(self, v): - regs = self.cpu.vm_get_gpreg() + def push_uint16_t(self, v): + regs = self.cpu.get_gpreg() regs['SP'] -= 2 - self.cpu.vm_set_gpreg(regs) - self.vm.vm_set_mem(regs['SP'], pck16(v)) + self.cpu.set_gpreg(regs) + self.vm.set_mem(regs['SP'], pck16(v)) - def vm_pop_uint16_t(self): - regs = self.cpu.vm_get_gpreg() - x = upck16(self.vm.vm_get_mem(regs['SP'], 2)) + def pop_uint16_t(self): + regs = self.cpu.get_gpreg() + x = upck16(self.vm.get_mem(regs['SP'], 2)) regs['SP'] += 2 - self.cpu.vm_set_gpreg(regs) + self.cpu.set_gpreg(regs) return x def get_stack_arg(self, n): - regs = self.cpu.vm_get_gpreg() - x = upck16(self.vm.vm_get_mem(regs['SP'] + 2 * n, 2)) + regs = self.cpu.get_gpreg() + x = upck16(self.vm.get_mem(regs['SP'] + 2 * n, 2)) return x def init_run(self, *args, **kwargs): diff --git a/miasm2/arch/x86/jit.py b/miasm2/arch/x86/jit.py index f06ca306..f574a3ee 100644 --- a/miasm2/arch/x86/jit.py +++ b/miasm2/arch/x86/jit.py @@ -25,17 +25,17 @@ class jitter_x86_16(jitter): def ir_archbloc_fix_regs_for_mode(self, irbloc, attrib=64): self.orig_irbloc_fix_regs_for_mode(irbloc, 64) - def vm_push_uint16_t(self, v): + def push_uint16_t(self, v): self.cpu.SP -= self.ir_arch.sp.size / 8 - self.vm.vm_set_mem(self.cpu.SP, pck16(v)) + self.vm.set_mem(self.cpu.SP, pck16(v)) - def vm_pop_uint16_t(self): - x = upck16(self.vm.vm_get_mem(self.cpu.SP, self.ir_arch.sp.size / 8)) + def pop_uint16_t(self): + x = upck16(self.vm.get_mem(self.cpu.SP, self.ir_arch.sp.size / 8)) self.cpu.SP += self.ir_arch.sp.size / 8 return x def get_stack_arg(self, n): - x = upck16(self.vm.vm_get_mem(self.cpu.SP + 4 * n, 4)) + x = upck16(self.vm.get_mem(self.cpu.SP + 4 * n, 4)) return x def init_run(self, *args, **kwargs): @@ -57,27 +57,27 @@ class jitter_x86_32(jitter): def ir_archbloc_fix_regs_for_mode(self, irbloc, attrib=64): self.orig_irbloc_fix_regs_for_mode(irbloc, 64) - def vm_push_uint32_t(self, v): + def push_uint32_t(self, v): self.cpu.ESP -= self.ir_arch.sp.size / 8 - self.vm.vm_set_mem(self.cpu.ESP, pck32(v)) + self.vm.set_mem(self.cpu.ESP, pck32(v)) - def vm_pop_uint32_t(self): - x = upck32(self.vm.vm_get_mem(self.cpu.ESP, self.ir_arch.sp.size / 8)) + def pop_uint32_t(self): + x = upck32(self.vm.get_mem(self.cpu.ESP, self.ir_arch.sp.size / 8)) self.cpu.ESP += self.ir_arch.sp.size / 8 return x def get_stack_arg(self, n): - x = upck32(self.vm.vm_get_mem(self.cpu.ESP + 4 * n, 4)) + x = upck32(self.vm.get_mem(self.cpu.ESP + 4 * n, 4)) return x # calling conventions # stdcall def func_args_stdcall(self, n_args): - ret_ad = self.vm_pop_uint32_t() + ret_ad = self.pop_uint32_t() args = [] for _ in xrange(n_args): - args.append(self.vm_pop_uint32_t()) + args.append(self.pop_uint32_t()) log.debug('%s %s %s' % (whoami(), hex(ret_ad), [hex(x) for x in args])) return ret_ad, args @@ -90,7 +90,7 @@ class jitter_x86_32(jitter): # cdecl def func_args_cdecl(self, n_args, dolog=True): - ret_ad = self.vm_pop_uint32_t() + ret_ad = self.pop_uint32_t() args = [] for i in xrange(n_args): args.append(self.get_stack_arg(i)) @@ -121,7 +121,7 @@ class jitter_x86_32(jitter): f = win_api_x86_32.__dict__[fname] else: log.debug('%s' % repr(fname)) - raise ValueError('unknown api', hex(jitter.vm_pop_uint32_t()), repr(fname)) + raise ValueError('unknown api', hex(jitter.pop_uint32_t()), repr(fname)) f(jitter) jitter.pc = getattr(jitter.cpu, jitter.ir_arch.pc.name) return True @@ -148,17 +148,17 @@ class jitter_x86_64(jitter): def ir_archbloc_fix_regs_for_mode(self, irbloc, attrib=64): self.orig_irbloc_fix_regs_for_mode(irbloc, 64) - def vm_push_uint64_t(self, v): + def push_uint64_t(self, v): self.cpu.RSP -= self.ir_arch.sp.size / 8 - self.vm.vm_set_mem(self.cpu.RSP, pck64(v)) + self.vm.set_mem(self.cpu.RSP, pck64(v)) - def vm_pop_uint64_t(self): - x = upck64(self.vm.vm_get_mem(self.cpu.RSP, self.ir_arch.sp.size / 8)) + def pop_uint64_t(self): + x = upck64(self.vm.get_mem(self.cpu.RSP, self.ir_arch.sp.size / 8)) self.cpu.RSP += self.ir_arch.sp.size / 8 return x def get_stack_arg(self, n): - x = upck64(self.vm.vm_get_mem(self.cpu.RSP + 8 * n, 8)) + x = upck64(self.vm.get_mem(self.cpu.RSP + 8 * n, 8)) return x def init_run(self, *args, **kwargs): diff --git a/miasm2/jitter/arch/JitCore_arm.c b/miasm2/jitter/arch/JitCore_arm.c index de234564..cc5286eb 100644 --- a/miasm2/jitter/arch/JitCore_arm.c +++ b/miasm2/jitter/arch/JitCore_arm.c @@ -230,17 +230,17 @@ static PyMemberDef JitCpu_members[] = { }; static PyMethodDef JitCpu_methods[] = { - {"vm_init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, + {"init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, "X"}, - {"vm_dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, + {"dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, "X"}, - {"vm_get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, + {"get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, "X"}, - {"vm_set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, + {"set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, "X"}, - {"vm_get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, + {"get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, "X"}, - {"vm_set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, + {"set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, "X"}, {NULL} /* Sentinel */ }; diff --git a/miasm2/jitter/arch/JitCore_mips32.c b/miasm2/jitter/arch/JitCore_mips32.c index ebb1907a..3766768c 100644 --- a/miasm2/jitter/arch/JitCore_mips32.c +++ b/miasm2/jitter/arch/JitCore_mips32.c @@ -271,17 +271,17 @@ static PyMemberDef JitCpu_members[] = { }; static PyMethodDef JitCpu_methods[] = { - {"vm_init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, + {"init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, "X"}, - {"vm_dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, + {"dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, "X"}, - {"vm_get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, + {"get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, "X"}, - {"vm_set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, + {"set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, "X"}, - {"vm_get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, + {"get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, "X"}, - {"vm_set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, + {"set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, "X"}, {NULL} /* Sentinel */ }; diff --git a/miasm2/jitter/arch/JitCore_msp430.c b/miasm2/jitter/arch/JitCore_msp430.c index 20f15905..229288c9 100644 --- a/miasm2/jitter/arch/JitCore_msp430.c +++ b/miasm2/jitter/arch/JitCore_msp430.c @@ -523,17 +523,17 @@ static PyMemberDef JitCpu_members[] = { }; static PyMethodDef JitCpu_methods[] = { - {"vm_init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, + {"init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, "X"}, - {"vm_dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, + {"dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, "X"}, - {"vm_get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, + {"get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, "X"}, - {"vm_set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, + {"set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, "X"}, - {"vm_get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, + {"get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, "X"}, - {"vm_set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, + {"set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, "X"}, {NULL} /* Sentinel */ }; diff --git a/miasm2/jitter/arch/JitCore_x86.c b/miasm2/jitter/arch/JitCore_x86.c index bd5f57a8..c5bd62f0 100644 --- a/miasm2/jitter/arch/JitCore_x86.c +++ b/miasm2/jitter/arch/JitCore_x86.c @@ -362,21 +362,21 @@ static PyMemberDef JitCpu_members[] = { }; static PyMethodDef JitCpu_methods[] = { - {"vm_init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, + {"init_regs", (PyCFunction)cpu_init_regs, METH_NOARGS, "X"}, - {"vm_dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, + {"dump_gpregs", (PyCFunction)cpu_dump_gpregs, METH_NOARGS, "X"}, - {"vm_get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, + {"get_gpreg", (PyCFunction)cpu_get_gpreg, METH_NOARGS, "X"}, - {"vm_set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, + {"set_gpreg", (PyCFunction)cpu_set_gpreg, METH_VARARGS, "X"}, - {"vm_get_segm_base", (PyCFunction)cpu_get_segm_base, METH_VARARGS, + {"get_segm_base", (PyCFunction)cpu_get_segm_base, METH_VARARGS, "X"}, - {"vm_set_segm_base", (PyCFunction)cpu_set_segm_base, METH_VARARGS, + {"set_segm_base", (PyCFunction)cpu_set_segm_base, METH_VARARGS, "X"}, - {"vm_get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, + {"get_exception", (PyCFunction)cpu_get_exception, METH_VARARGS, "X"}, - {"vm_set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, + {"set_exception", (PyCFunction)cpu_set_exception, METH_VARARGS, "X"}, {NULL} /* Sentinel */ }; diff --git a/miasm2/jitter/jitcore.py b/miasm2/jitter/jitcore.py index 8bf42390..5ebc615e 100644 --- a/miasm2/jitter/jitcore.py +++ b/miasm2/jitter/jitcore.py @@ -81,9 +81,9 @@ class JitCore(object): self.blocs_mem_interval += interval([(bloc.ad_min, bloc.ad_max - 1)]) - vm.vm_reset_code_bloc_pool() + vm.reset_code_bloc_pool() for a, b in self.blocs_mem_interval: - vm.vm_add_code_bloc(a, b + 1) + vm.add_code_bloc(a, b + 1) def jitirblocs(self, label, irblocs): """JiT a group of irblocs. @@ -166,7 +166,7 @@ class JitCore(object): """ if lbl is None: - lbl = cpu.vm_get_gpreg()[self.ir_arch.pc.name] + lbl = cpu.get_gpreg()[self.ir_arch.pc.name] if not lbl in self.lbl2jitbloc: # Need to JiT the bloc @@ -195,11 +195,11 @@ class JitCore(object): """ # Reset the current pool - vm.vm_reset_code_bloc_pool() + vm.reset_code_bloc_pool() # Add blocs in the pool for a, b in self.blocs_mem_interval: - vm.vm_add_code_bloc(a, b + 1) + vm.add_code_bloc(a, b + 1) def del_bloc_in_range(self, ad1, ad2): """Find and remove jitted bloc in range [ad1, ad2]. diff --git a/miasm2/jitter/jitcore_python.py b/miasm2/jitter/jitcore_python.py index b71bd138..0df9f615 100644 --- a/miasm2/jitter/jitcore_python.py +++ b/miasm2/jitter/jitcore_python.py @@ -71,7 +71,7 @@ class JitCore_Python(jitcore.JitCore): addr = expr_mem.arg.arg.arg size = expr_mem.size / 8 - value = self.vmmngr.vm_get_mem(addr, size) + value = self.vmmngr.get_mem(addr, size) return m2_expr.ExprInt_fromsize(expr_mem.size, int(value[::-1].encode("hex"), 16)) @@ -97,7 +97,7 @@ class JitCore_Python(jitcore.JitCore): content = content.decode("hex")[::-1] # Write in VmMngr context - self.vmmngr.vm_set_mem(addr, content) + self.vmmngr.set_mem(addr, content) def jitirblocs(self, label, irblocs): """Create a python function corresponding to an irblocs' group. @@ -147,14 +147,14 @@ class JitCore_Python(jitcore.JitCore): # Log registers values if self.log_regs: update_cpu_from_engine(cpu, exec_engine) - cpu.vm_dump_gpregs() + cpu.dump_gpregs() # Log instruction if self.log_mn: print "%08x %s" % (line.offset, line) # Check for memory exception - if (vmmngr.vm_get_exception() != 0): + if (vmmngr.get_exception() != 0): update_cpu_from_engine(cpu, exec_engine) return line.offset @@ -162,7 +162,7 @@ class JitCore_Python(jitcore.JitCore): exec_engine.eval_ir(ir) # Check for memory exception which do not update PC - if (vmmngr.vm_get_exception() & csts.EXCEPT_DO_NOT_UPDATE_PC != 0): + if (vmmngr.get_exception() & csts.EXCEPT_DO_NOT_UPDATE_PC != 0): update_cpu_from_engine(cpu, exec_engine) return line.offset diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py index f79b5f79..86fe8f8c 100644 --- a/miasm2/jitter/jitload.py +++ b/miasm2/jitter/jitload.py @@ -43,14 +43,14 @@ class bin_stream_vm(bin_stream): def getbytes(self, start, l=1): try: - s = self.vm.vm_get_mem(start + self.base_offset, l) + s = self.vm.get_mem(start + self.base_offset, l) except: raise IOError('cannot get mem ad', hex(start)) return s def readbs(self, l=1): try: - s = self.vm.vm_get_mem(self.offset + self.base_offset, l) + s = self.vm.get_mem(self.offset + self.base_offset, l) except: raise IOError('cannot get mem ad', hex(self.offset)) self.offset += l @@ -94,7 +94,7 @@ def preload_pe(vm, e, runtime_lib, patch_vm_imp=True): libname_s = canon_libname_libfunc(libname, libfunc) dyn_funcs[libname_s] = ad_libfunc if patch_vm_imp: - vm.vm_set_mem( + vm.set_mem( ad, struct.pack(cstruct.size2type[e._wsize], ad_libfunc)) return dyn_funcs @@ -124,7 +124,7 @@ def preload_elf(vm, e, runtime_lib, patch_vm_imp=True): if patch_vm_imp: log.debug('patch %s %s %s' % (hex(ad), hex(ad_libfunc), libfunc)) - vm.vm_set_mem( + vm.set_mem( ad, struct.pack(cstruct.size2type[e.size], ad_libfunc)) return runtime_lib, dyn_funcs @@ -369,7 +369,7 @@ def vm_load_pe(vm, fname, align_s=True, load_hdr=True, pe_hdr = e.content[:hdr_len] pe_hdr = pe_hdr + min_len * "\x00" pe_hdr = pe_hdr[:min_len] - vm.vm_add_memory_page( + vm.add_memory_page( e.NThdr.ImageBase, PAGE_READ | PAGE_WRITE, pe_hdr) if align_s: for i, s in enumerate(e.SHList[:-1]): @@ -384,7 +384,7 @@ def vm_load_pe(vm, fname, align_s=True, load_hdr=True, data += "\x00" * (s.size - len(data)) # log.debug('SECTION %s %s' % (hex(s.addr), # hex(e.rva2virt(s.addr)))) - vm.vm_add_memory_page( + vm.add_memory_page( e.rva2virt(s.addr), PAGE_READ | PAGE_WRITE, data) # s.offset = s.addr return e @@ -415,12 +415,12 @@ def vm_load_pe(vm, fname, align_s=True, load_hdr=True, log.debug('%s %s %s' % (hex(min_addr), hex(max_addr), hex(max_addr - min_addr))) - vm.vm_add_memory_page(min_addr, + vm.add_memory_page(min_addr, PAGE_READ | PAGE_WRITE, (max_addr - min_addr) * "\x00") for s in e.SHList: log.debug('%s %s' % (hex(e.rva2virt(s.addr)), len(s.data))) - vm.vm_set_mem(e.rva2virt(s.addr), str(s.data)) + vm.set_mem(e.rva2virt(s.addr), str(s.data)) return e @@ -448,12 +448,12 @@ def vm_load_elf(vm, fname, **kargs): i += [(a_addr, b_addr-2)] for a, b in i.intervals: #print hex(a), hex(b) - vm.vm_add_memory_page(a, PAGE_READ | PAGE_WRITE, "\x00"*(b+2-a)) + vm.add_memory_page(a, PAGE_READ | PAGE_WRITE, "\x00"*(b+2-a)) - #vm.vm_dump_memory_page_pool() + #vm.dump_memory_page_pool() for r_vaddr, data in all_data.items(): - vm.vm_set_mem(r_vaddr, data) + vm.set_mem(r_vaddr, data) return e def vm_load_pe_lib(fname_in, libs, lib_path_base, patch_vm_imp, **kargs): @@ -614,12 +614,12 @@ class jitter: else: raise Exception("Unkown JiT Backend") - self.cpu.vm_init_regs() - self.vm.vm_init_memory_page_pool() - self.vm.vm_init_code_bloc_pool() - self.vm.vm_init_memory_breakpoint() + self.cpu.init_regs() + self.vm.init_memory_page_pool() + self.vm.init_code_bloc_pool() + self.vm.init_memory_breakpoint() - self.vm.vm_set_addr2obj(self.jit.addr2obj) + self.vm.set_addr2obj(self.jit.addr2obj) self.jit.load() self.stack_size = 0x10000 @@ -636,11 +636,11 @@ class jitter: def exception_automod(jitter): "Tell the JiT backend to update blocs modified" - addr = self.vm.vm_get_last_write_ad() - size = self.vm.vm_get_last_write_size() + addr = self.vm.get_last_write_ad() + size = self.vm.get_last_write_size() self.jit.updt_automod_code(self.vm, addr, size) - self.vm.vm_set_exception(0) + self.vm.set_exception(0) return True @@ -752,16 +752,16 @@ class jitter: return None def init_stack(self): - self.vm.vm_add_memory_page( + self.vm.add_memory_page( self.stack_base, PAGE_READ | PAGE_WRITE, "\x00" * self.stack_size) sp = self.arch.getsp(self.attrib) setattr(self.cpu, sp.name, self.stack_base + self.stack_size) - # regs = self.cpu.vm_get_gpreg() + # regs = self.cpu.get_gpreg() # regs[sp.name] = self.stack_base+self.stack_size - # self.cpu.vm_set_gpreg(regs) + # self.cpu.set_gpreg(regs) def get_exception(self): - return self.cpu.vm_get_exception() | self.vm.vm_get_exception() + return self.cpu.get_exception() | self.vm.get_exception() # commun functions def get_str_ansi(self, addr, max_char=None): @@ -771,10 +771,10 @@ class jitter: l = 0 tmp = addr while ((max_char is None or l < max_char) and - self.vm.vm_get_mem(tmp, 1) != "\x00"): + self.vm.get_mem(tmp, 1) != "\x00"): tmp += 1 l += 1 - return self.vm.vm_get_mem(addr, l) + return self.vm.get_mem(addr, l) def get_str_unic(self, addr, max_char=None): """Get unicode str from vm. @@ -783,22 +783,22 @@ class jitter: l = 0 tmp = addr while ((max_char is None or l < max_char) and - self.vm.vm_get_mem(tmp, 2) != "\x00\x00"): + self.vm.get_mem(tmp, 2) != "\x00\x00"): tmp += 2 l += 2 - s = self.vm.vm_get_mem(addr, l) + s = self.vm.get_mem(addr, l) s = s[::2] # TODO: real unicode decoding return s def set_str_ansi(self, addr, s): """Set an ansi string in memory""" s = s + "\x00" - self.vm.vm_set_mem(addr, s) + self.vm.set_mem(addr, s) def set_str_unic(self, addr, s): """Set an unicode string in memory""" s = "\x00".join(list(s)) + '\x00' * 3 - self.vm.vm_set_mem(addr, s) + self.vm.set_mem(addr, s) @@ -814,7 +814,7 @@ def vm2pe(myjit, fname, libs=None, e_orig=None, img_base = e_orig.NThdr.ImageBase mye.NThdr.ImageBase = img_base - all_mem = myjit.vm.vm_get_all_memory() + all_mem = myjit.vm.get_all_memory() addrs = all_mem.keys() addrs.sort() mye.Opthdr.AddressOfEntryPoint = mye.virt2rva(myjit.cpu.EIP) diff --git a/miasm2/jitter/os_dep/linux_stdlib.py b/miasm2/jitter/os_dep/linux_stdlib.py index 50208b93..9dbc6c60 100644 --- a/miasm2/jitter/os_dep/linux_stdlib.py +++ b/miasm2/jitter/os_dep/linux_stdlib.py @@ -25,7 +25,7 @@ def xxx_memcpy(jitter): copies n bytes from memory area src to memory area dest. ''' ret_addr, (dest, src, n) = jitter.func_args_stdcall(3) - jitter.vm.vm_set_mem(dest, jitter.vm.vm_get_mem(src, n)) + jitter.vm.set_mem(dest, jitter.vm.get_mem(src, n)) return jitter.func_ret_stdcall(ret_addr, dest) @@ -38,7 +38,7 @@ def xxx_puts(jitter): ''' ret_addr, (s,) = jitter.func_args_stdcall(1) while True: - c = jitter.vm.vm_get_mem(s, 1) + c = jitter.vm.get_mem(s, 1) s += 1 if c == '\x00': break @@ -57,14 +57,14 @@ def xxx_snprintf(jitter): ret_addr, (str, size, format) = jitter.func_args_stdcall(3) curarg, output = 3, '' while True: - c = jitter.vm.vm_get_mem(format, 1) + c = jitter.vm.get_mem(format, 1) format += 1 if c == '\x00': break if c == '%': token = '%' while True: - c = jitter.vm.vm_get_mem(format, 1) + c = jitter.vm.get_mem(format, 1) format += 1 token += c if c in '%cdfsux': @@ -74,5 +74,5 @@ def xxx_snprintf(jitter): output += c output = output[:size - 1] ret = len(output) - jitter.vm.vm_set_mem(str, output + '\x00') + jitter.vm.set_mem(str, output + '\x00') return jitter.func_ret_stdcall(ret_addr, ret) diff --git a/miasm2/jitter/os_dep/win_api_x86_32.py b/miasm2/jitter/os_dep/win_api_x86_32.py index a0a2648d..923e9fd8 100644 --- a/miasm2/jitter/os_dep/win_api_x86_32.py +++ b/miasm2/jitter/os_dep/win_api_x86_32.py @@ -50,7 +50,7 @@ def get_next_alloc_addr(size): def alloc_mem(jitter, msize): alloc_addr = get_next_alloc_addr(msize) - jitter.vm.vm_add_memory_page( + jitter.vm.add_memory_page( alloc_addr, PAGE_READ | PAGE_WRITE, "\x00" * msize) return alloc_addr @@ -259,20 +259,20 @@ def get_str_ansi(jitter, ad_str, max_char=None): l = 0 tmp = ad_str while ((max_char is None or l < max_char) and - jitter.vm.vm_get_mem(tmp, 1) != "\x00"): + jitter.vm.get_mem(tmp, 1) != "\x00"): tmp += 1 l += 1 - return jitter.vm.vm_get_mem(ad_str, l) + return jitter.vm.get_mem(ad_str, l) def get_str_unic(jitter, ad_str, max_char=None): l = 0 tmp = ad_str while ((max_char is None or l < max_char) and - jitter.vm.vm_get_mem(tmp, 2) != "\x00\x00"): + jitter.vm.get_mem(tmp, 2) != "\x00\x00"): tmp += 2 l += 2 - s = jitter.vm.vm_get_mem(ad_str, l) + s = jitter.vm.get_mem(ad_str, l) s = s[::2] # TODO: real unicode decoding return s @@ -354,7 +354,7 @@ def kernel32_Process32First(jitter): pentry = struct.pack( 'IIIIIIIII', *process_list[0][:-1]) + process_list[0][-1] - jitter.vm.vm_set_mem(ad_pentry, pentry) + jitter.vm.set_mem(ad_pentry, pentry) winobjs.toolhelpsnapshot_info[s_handle] = 0 jitter.func_ret_stdcall(ret_ad, 1) @@ -372,7 +372,7 @@ def kernel32_Process32Next(jitter): n = winobjs.toolhelpsnapshot_info[s_handle] pentry = struct.pack( 'IIIIIIIII', *process_list[n][:-1]) + process_list[n][-1] - jitter.vm.vm_set_mem(ad_pentry, pentry) + jitter.vm.set_mem(ad_pentry, pentry) jitter.func_ret_stdcall(ret_ad, ret) @@ -402,7 +402,7 @@ def kernel32_GetVersionEx(jitter, set_str = set_str_unic): t = s + (t + '\x00' * 128 * 2)[:128 * 2] t += struct.pack('HHHBB', 3, 0, 0x100, 1, 0) s = t - jitter.vm.vm_set_mem(ptr_struct, s) + jitter.vm.set_mem(ptr_struct, s) jitter.func_ret_stdcall(ret_ad, 1) @@ -460,7 +460,7 @@ def advapi32_CryptAcquireContext(jitter, funcname, get_str): else: prov = "NONE" log.debug('prov: %r'%prov) - jitter.vm.vm_set_mem(phprov, pck32(winobjs.cryptcontext_hwnd)) + jitter.vm.set_mem(phprov, pck32(winobjs.cryptcontext_hwnd)) jitter.func_ret_stdcall(ret_ad, 1) @@ -481,7 +481,7 @@ def advapi32_CryptCreateHash(jitter): if algid == 0x00008003: log.debug('algo is MD5') - jitter.vm.vm_set_mem( + jitter.vm.set_mem( phhash, pck32(winobjs.cryptcontext_bnum + winobjs.cryptcontext_num)) winobjs.cryptcontext[ winobjs.cryptcontext_bnum + winobjs.cryptcontext_num] = hobj() @@ -489,7 +489,7 @@ def advapi32_CryptCreateHash(jitter): winobjs.cryptcontext_bnum + winobjs.cryptcontext_num].h = MD5.new() elif algid == 0x00008004: log.debug('algo is SHA1') - jitter.vm.vm_set_mem( + jitter.vm.set_mem( phhash, pck32(winobjs.cryptcontext_bnum + winobjs.cryptcontext_num)) winobjs.cryptcontext[ winobjs.cryptcontext_bnum + winobjs.cryptcontext_num] = hobj() @@ -507,7 +507,7 @@ def advapi32_CryptHashData(jitter): if not hhash in winobjs.cryptcontext: raise ValueError("unknown crypt context") - data = jitter.vm.vm_get_mem(pbdata, dwdatalen) + data = jitter.vm.get_mem(pbdata, dwdatalen) log.debug('will hash %X' % dwdatalen) log.debug(repr(data[:10]) + "...") winobjs.cryptcontext[hhash].h.update(data) @@ -526,8 +526,8 @@ def advapi32_CryptGetHashParam(jitter): h = winobjs.cryptcontext[hhash].h.digest() else: raise ValueError('not impl', param) - jitter.vm.vm_set_mem(pbdata, h) - jitter.vm.vm_set_mem(dwdatalen, pck32(len(h))) + jitter.vm.set_mem(pbdata, h) + jitter.vm.set_mem(dwdatalen, pck32(len(h))) jitter.func_ret_stdcall(ret_ad, 1) @@ -549,7 +549,7 @@ def advapi32_CryptDeriveKey(jitter): h = winobjs.cryptcontext[hbasedata].h.digest() log.debug('hash %r'% h) winobjs.cryptcontext[hbasedata].h_result = h - jitter.vm.vm_set_mem(phkey, pck32(hbasedata)) + jitter.vm.set_mem(phkey, pck32(hbasedata)) jitter.func_ret_stdcall(ret_ad, 1) @@ -700,8 +700,8 @@ def kernel32_ReadFile(jitter): if data is not None: if (lpnumberofbytesread): - jitter.vm.vm_set_mem(lpnumberofbytesread, pck32(len(data))) - jitter.vm.vm_set_mem(lpbuffer, data) + jitter.vm.set_mem(lpnumberofbytesread, pck32(len(data))) + jitter.vm.set_mem(lpbuffer, data) jitter.func_ret_stdcall(ret_ad, 1) @@ -719,7 +719,7 @@ def kernel32_GetFileSize(jitter): raise ValueError('unknown hwnd!') if lpfilesizehight != 0: - jitter.vm.vm_set_mem(lpfilesizehight, pck32(ret)) + jitter.vm.set_mem(lpfilesizehight, pck32(ret)) jitter.func_ret_stdcall(ret_ad, ret) @@ -737,7 +737,7 @@ def kernel32_GetFileSizeEx(jitter): if lpfilesizehight == 0: raise NotImplementedError("Untested case") - jitter.vm.vm_set_mem(lpfilesizehight, pck32( + jitter.vm.set_mem(lpfilesizehight, pck32( l & 0xffffffff) + pck32((l >> 32) & 0xffffffff)) jitter.func_ret_stdcall(ret_ad, 1) @@ -757,11 +757,11 @@ def kernel32_VirtualProtect(jitter): if not flnewprotect in access_dict: raise ValueError('unknown access dw!') - jitter.vm.vm_set_mem_access(lpvoid, access_dict[flnewprotect]) + jitter.vm.set_mem_access(lpvoid, access_dict[flnewprotect]) # XXX todo real old protect if lpfloldprotect: - jitter.vm.vm_set_mem(lpfloldprotect, pck32(0x40)) + jitter.vm.set_mem(lpfloldprotect, pck32(0x40)) jitter.func_ret_stdcall(ret_ad, 1) @@ -787,17 +787,17 @@ def kernel32_VirtualAlloc(jitter): if lpvoid == 0: alloc_addr = get_next_alloc_addr(dwsize) - jitter.vm.vm_add_memory_page( + jitter.vm.add_memory_page( alloc_addr, access_dict[flprotect], "\x00" * dwsize) else: - all_mem = jitter.vm.vm_get_all_memory() + all_mem = jitter.vm.get_all_memory() if lpvoid in all_mem: alloc_addr = lpvoid - jitter.vm.vm_set_mem_access(lpvoid, access_dict[flprotect]) + jitter.vm.set_mem_access(lpvoid, access_dict[flprotect]) else: alloc_addr = get_next_alloc_addr(dwsize) # alloc_addr = lpvoid - jitter.vm.vm_add_memory_page( + jitter.vm.add_memory_page( alloc_addr, access_dict[flprotect], "\x00" * dwsize) log.debug('Memory addr: %x' %alloc_addr) @@ -846,7 +846,7 @@ def kernel32_GetModuleFileName(jitter, funcname, set_str): l = len(p) if p: - jitter.vm.vm_set_mem(lpfilename, set_str(p)) + jitter.vm.set_mem(lpfilename, set_str(p)) jitter.func_ret_stdcall(ret_ad, l) @@ -896,7 +896,7 @@ def kernel32_CreateMutexW(jitter): def shell32_SHGetSpecialFolderLocation(jitter): ret_ad, args = jitter.func_args_stdcall(3) hwndowner, nfolder, ppidl = args - jitter.vm.vm_set_mem(ppidl, pck32(nfolder)) + jitter.vm.set_mem(ppidl, pck32(nfolder)) jitter.func_ret_stdcall(ret_ad, 0) @@ -909,7 +909,7 @@ def kernel32_SHGetPathFromIDList(jitter, funcname, set_str): s = set_str(s) else: raise ValueError('pidl not implemented', pidl) - jitter.vm.vm_set_mem(ppath, s) + jitter.vm.set_mem(ppath, s) jitter.func_ret_stdcall(ret_ad, 1) @@ -931,7 +931,7 @@ def kernel32_SetLastError(jitter): e, = args # lasterr addr # ad = seh_helper.FS_0_AD + 0x34 - # jitter.vm.vm_set_mem(ad, pck32(e)) + # jitter.vm.set_mem(ad, pck32(e)) winobjs.lastwin32error = e jitter.func_ret_stdcall(ret_ad, 0) @@ -1060,7 +1060,7 @@ def kernel32_GetSystemInfo(jitter): ret_ad, args = jitter.func_args_stdcall(1) sys_ptr, = args sysinfo = systeminfo() - jitter.vm.vm_set_mem(sys_ptr, sysinfo.pack()) + jitter.vm.set_mem(sys_ptr, sysinfo.pack()) jitter.func_ret_stdcall(ret_ad, 0) @@ -1068,7 +1068,7 @@ def kernel32_IsWow64Process(jitter): ret_ad, args = jitter.func_args_stdcall(2) h, bool_ptr = args - jitter.vm.vm_set_mem(bool_ptr, pck32(0)) + jitter.vm.set_mem(bool_ptr, pck32(0)) jitter.func_ret_stdcall(ret_ad, 1) @@ -1077,7 +1077,7 @@ def kernel32_GetCommandLineA(jitter): s = winobjs.module_path + '\x00' s = '"%s"' % s alloc_addr = alloc_mem(jitter, 0x1000) - jitter.vm.vm_set_mem(alloc_addr, s) + jitter.vm.set_mem(alloc_addr, s) jitter.func_ret_stdcall(ret_ad, alloc_addr) @@ -1086,7 +1086,7 @@ def kernel32_GetCommandLineW(jitter): s = winobjs.module_path + '\x00' s = set_str_unic('"%s"' % s) alloc_addr = alloc_mem(jitter, 0x1000) - jitter.vm.vm_set_mem(alloc_addr, s) + jitter.vm.set_mem(alloc_addr, s) jitter.func_ret_stdcall(ret_ad, alloc_addr) @@ -1101,12 +1101,12 @@ def shell32_CommandLineToArgvW(jitter): o = 0 for i, t in enumerate(tks): x = set_str_unic(t) + "\x00\x00" - jitter.vm.vm_set_mem(addr_ret + 4 * i, pck32(addr + o)) - jitter.vm.vm_set_mem(addr + o, x) + jitter.vm.set_mem(addr_ret + 4 * i, pck32(addr + o)) + jitter.vm.set_mem(addr + o, x) o += len(x) + 2 - jitter.vm.vm_set_mem(addr_ret + 4 * i, pck32(0)) - jitter.vm.vm_set_mem(pnumargs, pck32(len(tks))) + jitter.vm.set_mem(addr_ret + 4 * i, pck32(0)) + jitter.vm.set_mem(pnumargs, pck32(len(tks))) jitter.func_ret_stdcall(ret_ad, addr_ret) @@ -1117,7 +1117,7 @@ def cryptdll_MD5Init(jitter): h = MD5.new() winobjs.cryptdll_md5_h[index] = h - jitter.vm.vm_set_mem(ad_ctx, pck32(index)) + jitter.vm.set_mem(ad_ctx, pck32(index)) jitter.func_ret_stdcall(ret_ad, 0) @@ -1125,12 +1125,12 @@ def cryptdll_MD5Update(jitter): ret_ad, args = jitter.func_args_stdcall(3) ad_ctx, ad_input, inlen = args - index = jitter.vm.vm_get_mem(ad_ctx, 4) + index = jitter.vm.get_mem(ad_ctx, 4) index = upck32(index) if not index in winobjs.cryptdll_md5_h: raise ValueError('unknown h context', index) - data = jitter.vm.vm_get_mem(ad_input, inlen) + data = jitter.vm.get_mem(ad_input, inlen) winobjs.cryptdll_md5_h[index].update(data) log.debug(hexdump(data)) @@ -1141,12 +1141,12 @@ def cryptdll_MD5Final(jitter): ret_ad, args = jitter.func_args_stdcall(1) ad_ctx, = args - index = jitter.vm.vm_get_mem(ad_ctx, 4) + index = jitter.vm.get_mem(ad_ctx, 4) index = upck32(index) if not index in winobjs.cryptdll_md5_h: raise ValueError('unknown h context', index) h = winobjs.cryptdll_md5_h[index].digest() - jitter.vm.vm_set_mem(ad_ctx + 88, h) + jitter.vm.set_mem(ad_ctx + 88, h) jitter.func_ret_stdcall(ret_ad, 0) @@ -1156,7 +1156,7 @@ def ntdll_RtlInitAnsiString(jitter): s = get_str_ansi(jitter, ad_str) l = len(s) - jitter.vm.vm_set_mem(ad_ctx, pck16(l) + pck16(l + 1) + pck32(ad_str)) + jitter.vm.set_mem(ad_ctx, pck16(l) + pck16(l + 1) + pck32(ad_str)) jitter.func_ret_stdcall(ret_ad, 0) @@ -1167,8 +1167,8 @@ def ntdll_RtlHashUnicodeString(jitter): if h_id != 1: raise ValueError('unk hash unicode', h_id) - l1, l2, ptra = struct.unpack('HHL', jitter.vm.vm_get_mem(ad_ctxu, 8)) - s = jitter.vm.vm_get_mem(ptra, l1) + l1, l2, ptra = struct.unpack('HHL', jitter.vm.get_mem(ad_ctxu, 8)) + s = jitter.vm.get_mem(ptra, l1) s = s[:-1] hv = 0 @@ -1176,15 +1176,15 @@ def ntdll_RtlHashUnicodeString(jitter): s = s.lower() for c in s: hv = ((65599 * hv) + ord(c)) & 0xffffffff - jitter.vm.vm_set_mem(phout, pck32(hv)) + jitter.vm.set_mem(phout, pck32(hv)) jitter.func_ret_stdcall(ret_ad, 0) def kernel32_RtlMoveMemory(jitter): ret_ad, args = jitter.func_args_stdcall(3) ad_dst, ad_src, m_len = args - data = jitter.vm.vm_get_mem(ad_src, m_len) - jitter.vm.vm_set_mem(ad_dst, data) + data = jitter.vm.get_mem(ad_src, m_len) + jitter.vm.set_mem(ad_dst, data) jitter.func_ret_stdcall(ret_ad, 0) @@ -1192,9 +1192,9 @@ def kernel32_RtlMoveMemory(jitter): def ntdll_RtlAnsiCharToUnicodeChar(jitter): ret_ad, args = jitter.func_args_stdcall(1) ad_ad_ch, = args - ad_ch = upck32(jitter.vm.vm_get_mem(ad_ad_ch, 4)) - ch = ord(jitter.vm.vm_get_mem(ad_ch, 1)) - jitter.vm.vm_set_mem(ad_ad_ch, pck32(ad_ch + 1)) + ad_ch = upck32(jitter.vm.get_mem(ad_ad_ch, 4)) + ch = ord(jitter.vm.get_mem(ad_ch, 1)) + jitter.vm.set_mem(ad_ad_ch, pck32(ad_ch + 1)) jitter.func_ret_stdcall(ret_ad, ch) @@ -1206,11 +1206,11 @@ def ntdll_RtlFindCharInUnicodeString(jitter): if flags != 0: raise ValueError('unk flags') - ml1, ml2, mptra = struct.unpack('HHL', jitter.vm.vm_get_mem(main_str_ad, 8)) + ml1, ml2, mptra = struct.unpack('HHL', jitter.vm.get_mem(main_str_ad, 8)) sl1, sl2, sptra = struct.unpack( - 'HHL', jitter.vm.vm_get_mem(search_chars_ad, 8)) - main_data = jitter.vm.vm_get_mem(mptra, ml1)[:-1] - search_data = jitter.vm.vm_get_mem(sptra, sl1)[:-1] + 'HHL', jitter.vm.get_mem(search_chars_ad, 8)) + main_data = jitter.vm.get_mem(mptra, ml1)[:-1] + search_data = jitter.vm.get_mem(sptra, sl1)[:-1] pos = None for i, c in enumerate(main_data): @@ -1222,10 +1222,10 @@ def ntdll_RtlFindCharInUnicodeString(jitter): break if pos is None: ret = 0xC0000225 - jitter.vm.vm_set_mem(pos_ad, pck32(0)) + jitter.vm.set_mem(pos_ad, pck32(0)) else: ret = 0 - jitter.vm.vm_set_mem(pos_ad, pck32(pos)) + jitter.vm.set_mem(pos_ad, pck32(pos)) jitter.func_ret_stdcall(ret_ad, ret) @@ -1234,7 +1234,7 @@ def ntdll_RtlComputeCrc32(jitter): ret_ad, args = jitter.func_args_stdcall(3) dwinit, pdata, ilen = args - data = jitter.vm.vm_get_mem(pdata, ilen) + data = jitter.vm.get_mem(pdata, ilen) crc_r = crc32(data, dwinit) jitter.func_ret_stdcall(ret_ad, crc_r) @@ -1278,8 +1278,8 @@ def ntdll_RtlLargeIntegerSubtract(jitter): def ntdll_RtlCompareMemory(jitter): ret_ad, args = jitter.func_args_stdcall(3) ad1, ad2, m_len = args - data1 = jitter.vm.vm_get_mem(ad1, m_len) - data2 = jitter.vm.vm_get_mem(ad2, m_len) + data1 = jitter.vm.get_mem(ad1, m_len) + data2 = jitter.vm.get_mem(ad2, m_len) i = 0 while data1[i] == data2[i]: @@ -1316,7 +1316,7 @@ def kernel32_IsBadReadPtr(jitter): def ntoskrnl_KeInitializeEvent(jitter): ret_ad, args = jitter.func_args_stdcall(3) my_event, my_type, my_state = args - jitter.vm.vm_set_mem(my_event, pck32(winobjs.win_event_num)) + jitter.vm.set_mem(my_event, pck32(winobjs.win_event_num)) winobjs.win_event_num += 1 jitter.func_ret_stdcall(ret_ad, 0) @@ -1334,7 +1334,7 @@ def ntoskrnl_RtlGetVersion(jitter): 0x2, # platform id ) + set_str_unic("Service pack 4") - jitter.vm.vm_set_mem(ptr_version, s) + jitter.vm.set_mem(ptr_version, s) jitter.func_ret_stdcall(ret_ad, 0) @@ -1342,10 +1342,10 @@ def ntoskrnl_RtlVerifyVersionInfo(jitter): ret_ad, args = jitter.func_args_stdcall(1) ptr_version, = args - s = jitter.vm.vm_get_mem(ptr_version, 0x5 * 4) + s = jitter.vm.get_mem(ptr_version, 0x5 * 4) s_size, s_majv, s_minv, s_buildn, s_platform = struct.unpack('IIIII', s) raise NotImplementedError("Untested case") - jitter.vm.vm_set_mem(ptr_version, s) + jitter.vm.set_mem(ptr_version, s) jitter.func_ret_stdcall(ret_ad, 0) @@ -1367,7 +1367,7 @@ def ntoskrnl_IoAllocateMdl(jitter): v_addr, l, second_buf, chargequota, pirp = args m = mdl(v_addr, l) winobjs.nt_mdl[winobjs.nt_mdl_cur] = m - jitter.vm.vm_set_mem(mdl2ad(winobjs.nt_mdl_cur), str(m)) + jitter.vm.set_mem(mdl2ad(winobjs.nt_mdl_cur), str(m)) jitter.func_ret_stdcall(ret_ad, mdl2ad(winobjs.nt_mdl_cur)) winobjs.nt_mdl_cur += 1 @@ -1434,7 +1434,7 @@ def ntoskrnl_ExAllocatePoolWithTagPriority(jitter): pool_type, nbr_of_bytes, tag, priority = args alloc_addr = get_next_alloc_addr(nbr_of_bytes) - jitter.vm.vm_add_memory_page( + jitter.vm.add_memory_page( alloc_addr, PAGE_READ | PAGE_WRITE, "\x00" * nbr_of_bytes) jitter.func_ret_stdcall(ret_ad, alloc_addr) @@ -1472,7 +1472,7 @@ def my_strcpy(jitter, funcname, get_str, set_str): ret_ad, args = jitter.func_args_stdcall(2) ptr_str1, ptr_str2 = args s2 = get_str(jitter, ptr_str2) - jitter.vm.vm_set_mem(ptr_str1, set_str(s2)) + jitter.vm.set_mem(ptr_str1, set_str(s2)) jitter.func_ret_stdcall(ret_ad, ptr_str1) @@ -1494,7 +1494,7 @@ def kernel32_lstrcpyn(jitter): ptr_str1, ptr_str2, mlen = args s2 = get_str_ansi(jitter, ptr_str2) s2 = s2[:mlen] - jitter.vm.vm_set_mem(ptr_str1, s2) + jitter.vm.set_mem(ptr_str1, s2) jitter.func_ret_stdcall(ret_ad, ptr_str1) @@ -1525,7 +1525,7 @@ def my_lstrcat(jitter, funcname, get_str): s2 = get_str(jitter, ptr_str2) s = s1 + s2 - jitter.vm.vm_set_mem(ptr_str1, s1 + s2) + jitter.vm.set_mem(ptr_str1, s1 + s2) jitter.func_ret_stdcall(ret_ad, ptr_str1) @@ -1563,19 +1563,19 @@ def my_GetVolumeInformation(jitter, funcname, get_str, set_str): if lpvolumenamebuffer: s = "volumename" s = s[:nvolumenamesize] - jitter.vm.vm_set_mem(lpvolumenamebuffer, set_str(s)) + jitter.vm.set_mem(lpvolumenamebuffer, set_str(s)) if lpvolumeserialnumber: - jitter.vm.vm_set_mem(lpvolumeserialnumber, pck32(11111111)) + jitter.vm.set_mem(lpvolumeserialnumber, pck32(11111111)) if lpmaximumcomponentlength: - jitter.vm.vm_set_mem(lpmaximumcomponentlength, pck32(0xff)) + jitter.vm.set_mem(lpmaximumcomponentlength, pck32(0xff)) if lpfilesystemflags: - jitter.vm.vm_set_mem(lpfilesystemflags, pck32(22222222)) + jitter.vm.set_mem(lpfilesystemflags, pck32(22222222)) if lpfilesystemnamebuffer: s = "filesystemname" s = s[:nfilesystemnamesize] - jitter.vm.vm_set_mem(lpfilesystemnamebuffer, set_str(s)) + jitter.vm.set_mem(lpfilesystemnamebuffer, set_str(s)) jitter.func_ret_stdcall(ret_ad, 1) @@ -1598,7 +1598,7 @@ def kernel32_MultiByteToWideChar(jitter): l = len(src) src = "\x00".join(list(src)) - jitter.vm.vm_set_mem(lpwidecharstr, src) + jitter.vm.set_mem(lpwidecharstr, src) jitter.func_ret_stdcall(ret_ad, l) @@ -1615,7 +1615,7 @@ def my_GetEnvironmentVariable(jitter, funcname, get_str, set_str, mylen): else: log.warning('WARNING unknown env variable %r' % s) v = "" - jitter.vm.vm_set_mem(lpbuffer, v) + jitter.vm.set_mem(lpbuffer, v) jitter.func_ret_stdcall(ret_ad, mylen(v)) @@ -1626,7 +1626,7 @@ def my_GetSystemDirectory(jitter, funcname, set_str): s = "c:\\windows\\system32" l = len(s) s = set_str(s) - jitter.vm.vm_set_mem(lpbuffer, s) + jitter.vm.set_mem(lpbuffer, s) jitter.func_ret_stdcall(ret_ad, l) @@ -1725,7 +1725,7 @@ def kernel32_SetFileAttributesA(jitter): ret = 1 else: ret = 0 - jitter.vm.vm_set_mem(seh_helper.FS_0_AD + 0x34, pck32(3)) + jitter.vm.set_mem(seh_helper.FS_0_AD + 0x34, pck32(3)) jitter.func_ret_stdcall(ret_ad, ret) @@ -1733,8 +1733,8 @@ def kernel32_SetFileAttributesA(jitter): def ntdll_RtlMoveMemory(jitter): ret_ad, args = jitter.func_args_stdcall(3) dst, src, l = args - s = jitter.vm.vm_get_mem(src, l) - jitter.vm.vm_set_mem(dst, s) + s = jitter.vm.get_mem(src, l) + jitter.vm.set_mem(dst, s) jitter.func_ret_stdcall(ret_ad, 1) @@ -1748,7 +1748,7 @@ def ntdll_ZwQuerySystemInformation(jitter): o = struct.pack('II', 0x22222222, 0x33333333) o += "\x00" * systeminformationl o = o[:systeminformationl] - jitter.vm.vm_set_mem(systeminformation, o) + jitter.vm.set_mem(systeminformation, o) else: raise ValueError('unknown sysinfo class', systeminformationclass) @@ -1759,17 +1759,17 @@ def ntdll_ZwProtectVirtualMemory(jitter): ret_ad, args = jitter.func_args_stdcall(5) handle, lppvoid, pdwsize, flnewprotect, lpfloldprotect = args - ad = upck32(jitter.vm.vm_get_mem(lppvoid, 4)) - dwsize = upck32(jitter.vm.vm_get_mem(pdwsize, 4)) + ad = upck32(jitter.vm.get_mem(lppvoid, 4)) + dwsize = upck32(jitter.vm.get_mem(pdwsize, 4)) # XXX mask hpart flnewprotect &= 0xFFF if not flnewprotect in access_dict: raise ValueError('unknown access dw!') - jitter.vm.vm_set_mem_access(ad, access_dict[flnewprotect]) + jitter.vm.set_mem_access(ad, access_dict[flnewprotect]) # XXX todo real old protect - jitter.vm.vm_set_mem(lpfloldprotect, pck32(0x40)) + jitter.vm.set_mem(lpfloldprotect, pck32(0x40)) dump_memory_page_pool_py() jitter.func_ret_stdcall(ret_ad, 1) @@ -1779,8 +1779,8 @@ def ntdll_ZwAllocateVirtualMemory(jitter): ret_ad, args = jitter.func_args_stdcall(6) handle, lppvoid, zerobits, pdwsize, alloc_type, flprotect = args - ad = upck32(jitter.vm.vm_get_mem(lppvoid, 4)) - dwsize = upck32(jitter.vm.vm_get_mem(pdwsize, 4)) + ad = upck32(jitter.vm.get_mem(lppvoid, 4)) + dwsize = upck32(jitter.vm.get_mem(pdwsize, 4)) access_dict = {0x0: 0, 0x1: 0, @@ -1798,9 +1798,9 @@ def ntdll_ZwAllocateVirtualMemory(jitter): raise ValueError('unknown access dw!') alloc_addr = get_next_alloc_addr(dwsize) - jitter.vm.vm_add_memory_page( + jitter.vm.add_memory_page( alloc_addr, access_dict[flprotect], "\x00" * dwsize) - jitter.vm.vm_set_mem(lppvoid, pck32(alloc_addr)) + jitter.vm.set_mem(lppvoid, pck32(alloc_addr)) dump_memory_page_pool_py() jitter.func_ret_stdcall(ret_ad, 0) @@ -1809,8 +1809,8 @@ def ntdll_ZwAllocateVirtualMemory(jitter): def ntdll_ZwFreeVirtualMemory(jitter): ret_ad, args = jitter.func_args_stdcall(4) handle, lppvoid, pdwsize, alloc_type = args - ad = upck32(jitter.vm.vm_get_mem(lppvoid, 4)) - dwsize = upck32(jitter.vm.vm_get_mem(pdwsize, 4)) + ad = upck32(jitter.vm.get_mem(lppvoid, 4)) + dwsize = upck32(jitter.vm.get_mem(pdwsize, 4)) jitter.func_ret_stdcall(ret_ad, 0) @@ -1823,7 +1823,7 @@ def ntdll_RtlInitString(jitter): l = len(s) + 1 o = struct.pack('HHI', l, l, source) - jitter.vm.vm_set_mem(pstring, o) + jitter.vm.set_mem(pstring, o) jitter.func_ret_stdcall(ret_ad, 0) @@ -1832,19 +1832,19 @@ def ntdll_RtlAnsiStringToUnicodeString(jitter): ret_ad, args = jitter.func_args_stdcall(3) dst, src, alloc_str = args - l1, l2, p_src = struct.unpack('HHI', jitter.vm.vm_get_mem(src, 0x8)) + l1, l2, p_src = struct.unpack('HHI', jitter.vm.get_mem(src, 0x8)) s = get_str_ansi(jitter, p_src) s = ("\x00".join(s + "\x00")) l = len(s) + 1 if alloc_str: alloc_addr = get_next_alloc_addr(l) - jitter.vm.vm_add_memory_page( + jitter.vm.add_memory_page( alloc_addr, PAGE_READ | PAGE_WRITE, "\x00" * l) else: alloc_addr = p_src - jitter.vm.vm_set_mem(alloc_addr, s) + jitter.vm.set_mem(alloc_addr, s) o = struct.pack('HHI', l, l, alloc_addr) - jitter.vm.vm_set_mem(dst, o) + jitter.vm.set_mem(dst, o) jitter.func_ret_stdcall(ret_ad, 0) @@ -1852,12 +1852,12 @@ def ntdll_LdrLoadDll(jitter): ret_ad, args = jitter.func_args_stdcall(4) path, flags, modname, modhandle = args - l1, l2, p_src = struct.unpack('HHI', jitter.vm.vm_get_mem(modname, 0x8)) + l1, l2, p_src = struct.unpack('HHI', jitter.vm.get_mem(modname, 0x8)) s = get_str_unic(jitter, p_src) libname = s.lower() ad = winobjs.runtime_dll.lib_get_add_base(libname) - jitter.vm.vm_set_mem(modhandle, pck32(ad)) + jitter.vm.set_mem(modhandle, pck32(ad)) jitter.func_ret_stdcall(ret_ad, 0) @@ -1866,7 +1866,7 @@ def ntdll_RtlFreeUnicodeString(jitter): ret_ad, args = jitter.func_args_stdcall(1) src, = args - l1, l2, p_src = struct.unpack('HHI', jitter.vm.vm_get_mem(src, 0x8)) + l1, l2, p_src = struct.unpack('HHI', jitter.vm.get_mem(src, 0x8)) s = get_str_unic(jitter, p_src) jitter.func_ret_stdcall(ret_ad, 0) @@ -1876,12 +1876,12 @@ def ntdll_LdrGetProcedureAddress(jitter): ret_ad, args = jitter.func_args_stdcall(4) libbase, pfname, opt, p_ad = args - l1, l2, p_src = struct.unpack('HHI', jitter.vm.vm_get_mem(pfname, 0x8)) + l1, l2, p_src = struct.unpack('HHI', jitter.vm.get_mem(pfname, 0x8)) fname = get_str_ansi(jitter, p_src) ad = winobjs.runtime_dll.lib_get_add_func(libbase, fname) - jitter.vm.vm_set_mem(p_ad, pck32(ad)) + jitter.vm.set_mem(p_ad, pck32(ad)) jitter.func_ret_stdcall(ret_ad, 0) @@ -1890,7 +1890,7 @@ def ntdll_memset(jitter): ret_ad, args = jitter.func_args_stdcall(3) arg_addr, arg_c, arg_size = args - jitter.vm.vm_set_mem(arg_addr, chr(arg_c) * arg_size) + jitter.vm.set_mem(arg_addr, chr(arg_c) * arg_size) jitter.func_ret_stdcall(ret_ad, arg_addr) @@ -1898,7 +1898,7 @@ def msvcrt_memset(jitter): ret_ad, args = jitter.func_args_cdecl(3) arg_addr, arg_c, arg_size = args - jitter.vm.vm_set_mem(arg_addr, chr(arg_c) * arg_size) + jitter.vm.set_mem(arg_addr, chr(arg_c) * arg_size) jitter.func_ret_cdecl(ret_ad, arg_addr) @@ -1906,8 +1906,8 @@ def msvcrt_memcpy(jitter): ret_ad, args = jitter.func_args_cdecl(3) dst, src, size = args - s = jitter.vm.vm_get_mem(src, size) - jitter.vm.vm_set_mem(dst, s) + s = jitter.vm.get_mem(src, size) + jitter.vm.set_mem(dst, s) jitter.func_ret_cdecl(ret_ad, dst) @@ -1915,8 +1915,8 @@ def msvcrt_memcmp(jitter): ret_ad, args = jitter.func_args_cdecl(3) ps1, ps2, size = args - s1 = jitter.vm.vm_get_mem(ps1, size) - s2 = jitter.vm.vm_get_mem(ps2, size) + s1 = jitter.vm.get_mem(ps1, size) + s2 = jitter.vm.get_mem(ps2, size) ret = cmp(s1, s2) jitter.func_ret_cdecl(ret_ad, ret) @@ -1942,7 +1942,7 @@ def shlwapi_PathRemoveFileSpecW(jitter): i = path.rfind('\\') if i == -1: i = 0 - jitter.vm.vm_set_mem(path_ad + i * 2, "\x00\x00") + jitter.vm.set_mem(path_ad + i * 2, "\x00\x00") path = get_str_unic(jitter, path_ad) jitter.func_ret_stdcall(ret_ad, 1) @@ -2044,7 +2044,7 @@ def shlwapi_StrToInt64Ex(jitter, funcname, get_str): else: raise ValueError('cannot decode int') - jitter.vm.vm_set_mem(pret, struct.pack('q', r)) + jitter.vm.set_mem(pret, struct.pack('q', r)) jitter.func_ret_stdcall(ret_ad, i) @@ -2121,7 +2121,7 @@ def advapi32_RegOpenKeyEx(jitter, funcname, get_str): else: log.error('unknown skey') - jitter.vm.vm_set_mem(phandle, pck32(ret_hkey)) + jitter.vm.set_mem(phandle, pck32(ret_hkey)) jitter.func_ret_stdcall(ret_ad, ret) @@ -2143,7 +2143,7 @@ def advapi32_RegSetValue(jitter, funcname, get_str): subkey = "" if pvalue: - value = jitter.vm.vm_get_mem(pvalue, length) + value = jitter.vm.get_mem(pvalue, length) else: value = None jitter.func_ret_stdcall(ret_ad, 0) @@ -2172,7 +2172,7 @@ def kernel32_GetLocaleInfo(jitter, funcname, set_str): if lctype == 0x3: buf = "ENGLISH" buf = buf[:cchdata - 1] - jitter.vm.vm_set_mem(lplcdata, set_str(buf)) + jitter.vm.set_mem(lplcdata, set_str(buf)) ret = len(buf) else: raise ValueError('unimpl localeid') @@ -2234,7 +2234,7 @@ def kernel32_GetStartupInfo(jitter, funcname, set_str): s = "\x00" * 0x2c + "\x81\x00\x00\x00" + "\x0a" - jitter.vm.vm_set_mem(ptr, s) + jitter.vm.set_mem(ptr, s) jitter.func_ret_stdcall(ret_ad, ptr) @@ -2272,7 +2272,7 @@ def user32_GetSystemMetrics(jitter): def wsock32_WSAStartup(jitter): ret_ad, args = jitter.func_args_stdcall(2) version, pwsadata = args - jitter.vm.vm_set_mem(pwsadata, "\x01\x01\x02\x02WinSock 2.0\x00") + jitter.vm.set_mem(pwsadata, "\x01\x01\x02\x02WinSock 2.0\x00") jitter.func_ret_stdcall(ret_ad, 0) @@ -2291,7 +2291,7 @@ def kernel32_GetLocalTime(jitter): 00, # seconds 999, # millisec ) - jitter.vm.vm_set_mem(lpsystemtime, s) + jitter.vm.set_mem(lpsystemtime, s) jitter.func_ret_stdcall(ret_ad, lpsystemtime) @@ -2309,7 +2309,7 @@ def kernel32_GetSystemTime(jitter): 00, # seconds 999, # millisec ) - jitter.vm.vm_set_mem(lpsystemtime, s) + jitter.vm.set_mem(lpsystemtime, s) jitter.func_ret_stdcall(ret_ad, lpsystemtime) @@ -2373,7 +2373,7 @@ def kernel32_MapViewOfFile(jitter): raise ValueError('unknown access dw!') alloc_addr = alloc_mem(jitter, len(data)) - jitter.vm.vm_set_mem(alloc_addr, data) + jitter.vm.set_mem(alloc_addr, data) winobjs.handle_mapped[ alloc_addr] = hfile_o, dwfileoffsethigh, dwfileoffsetlow, length @@ -2390,7 +2390,7 @@ def kernel32_UnmapViewOfFile(jitter): """ hfile_o, dwfileoffsethigh, dwfileoffsetlow, length = winobjs.handle_mapped[ad] off = (dwfileoffsethigh<<32) | dwfileoffsetlow - s = jitter.vm.vm_get_mem(ad, length) + s = jitter.vm.get_mem(ad, length) hfile_o.info.seek(off) hfile_o.info.write(s) hfile_o.info.close() @@ -2431,10 +2431,10 @@ def kernel32_GetDiskFreeSpace(jitter, funcname, get_str): else: rootpath = "" - jitter.vm.vm_set_mem(lpsectorpercluster, pck32(8)) - jitter.vm.vm_set_mem(lpbytespersector, pck32(0x200)) - jitter.vm.vm_set_mem(lpnumberoffreeclusters, pck32(0x222222)) - jitter.vm.vm_set_mem(lptotalnumberofclusters, pck32(0x333333)) + jitter.vm.set_mem(lpsectorpercluster, pck32(8)) + jitter.vm.set_mem(lpbytespersector, pck32(0x200)) + jitter.vm.set_mem(lpnumberoffreeclusters, pck32(0x222222)) + jitter.vm.set_mem(lptotalnumberofclusters, pck32(0x333333)) jitter.func_ret_stdcall(ret_ad, 1) @@ -2461,7 +2461,7 @@ def kernel32_VirtualQuery(jitter): } access_dict_inv = dict([(x[1], x[0]) for x in access_dict.items()]) - all_mem = jitter.vm.vm_get_all_memory() + all_mem = jitter.vm.get_all_memory() found = None for basead, m in all_mem.items(): if basead <= ad < basead + m['size']: @@ -2480,7 +2480,7 @@ def kernel32_VirtualQuery(jitter): 0x1000, access_dict_inv[m['access']], 0x01000000) - jitter.vm.vm_set_mem(lpbuffer, s) + jitter.vm.set_mem(lpbuffer, s) jitter.func_ret_stdcall(ret_ad, dwl) @@ -2488,8 +2488,8 @@ def kernel32_VirtualQuery(jitter): def kernel32_GetProcessAffinityMask(jitter): ret_ad, args = jitter.func_args_stdcall(3) hprocess, procaffmask, systemaffmask = args - jitter.vm.vm_set_mem(procaffmask, pck32(1)) - jitter.vm.vm_set_mem(systemaffmask, pck32(1)) + jitter.vm.set_mem(procaffmask, pck32(1)) + jitter.vm.set_mem(systemaffmask, pck32(1)) jitter.func_ret_stdcall(ret_ad, 1) @@ -2577,7 +2577,7 @@ def kernel32_WriteFile(jitter): (hwnd, lpbuffer, nnumberofbytestowrite, lpnumberofbyteswrite, lpoverlapped) = args - data = jitter.vm.vm_get_mem(lpbuffer, nnumberofbytestowrite) + data = jitter.vm.get_mem(lpbuffer, nnumberofbytestowrite) if hwnd == winobjs.module_cur_hwnd: pass @@ -2596,7 +2596,7 @@ def kernel32_WriteFile(jitter): raise ValueError('unknown filename') if (lpnumberofbyteswrite): - jitter.vm.vm_set_mem(lpnumberofbyteswrite, pck32(len(data))) + jitter.vm.set_mem(lpnumberofbyteswrite, pck32(len(data))) jitter.func_ret_stdcall(ret_ad, 1) @@ -2655,7 +2655,7 @@ def msvcrt_fopen(jitter): h = open(f, rw) eax = winobjs.handle_pool.add(f, h) alloc_addr = alloc_mem(jitter, 0x20) - jitter.vm.vm_set_mem(alloc_addr, pck32(0x11112222) + pck32( + jitter.vm.set_mem(alloc_addr, pck32(0x11112222) + pck32( 0) + pck32(0) + pck32(0) + pck32(eax)) # pck32(0x11112222) else: raise NotImplementedError("Untested case") @@ -2666,7 +2666,7 @@ def msvcrt_fopen(jitter): def msvcrt_fseek(jitter): ret_ad, args = jitter.func_args_cdecl(3) stream, offset, orig = args - fd = upck32(jitter.vm.vm_get_mem(stream + 0x10, 4)) + fd = upck32(jitter.vm.get_mem(stream + 0x10, 4)) if not fd in winobjs.handle_pool: raise NotImplementedError("Untested case") @@ -2678,7 +2678,7 @@ def msvcrt_fseek(jitter): def msvcrt_ftell(jitter): ret_ad, args = jitter.func_args_cdecl(1) stream, = args - fd = upck32(jitter.vm.vm_get_mem(stream + 0x10, 4)) + fd = upck32(jitter.vm.get_mem(stream + 0x10, 4)) if not fd in winobjs.handle_pool: raise NotImplementedError("Untested case") @@ -2690,7 +2690,7 @@ def msvcrt_ftell(jitter): def msvcrt_rewind(jitter): ret_ad, args = jitter.func_args_cdecl(1) stream, = args - fd = upck32(jitter.vm.vm_get_mem(stream + 0x10, 4)) + fd = upck32(jitter.vm.get_mem(stream + 0x10, 4)) if not fd in winobjs.handle_pool: raise NotImplementedError("Untested case") @@ -2702,19 +2702,19 @@ def msvcrt_rewind(jitter): def msvcrt_fread(jitter): ret_ad, args = jitter.func_args_cdecl(4) buf, size, nmemb, stream = args - fd = upck32(jitter.vm.vm_get_mem(stream + 0x10, 4)) + fd = upck32(jitter.vm.get_mem(stream + 0x10, 4)) if not fd in winobjs.handle_pool: raise NotImplementedError("Untested case") data = winobjs.handle_pool[fd].info.read(size * nmemb) - jitter.vm.vm_set_mem(buf, data) + jitter.vm.set_mem(buf, data) jitter.func_ret_cdecl(ret_ad, nmemb) def msvcrt_fclose(jitter): ret_ad, args = jitter.func_args_cdecl(1) stream, = args - fd = upck32(jitter.vm.vm_get_mem(stream + 0x10, 4)) + fd = upck32(jitter.vm.get_mem(stream + 0x10, 4)) if not fd in winobjs.handle_pool: raise NotImplementedError("Untested case") @@ -2746,7 +2746,7 @@ def kernel32_myGetTempPath(jitter, func): l, buf = args l = 'c:\\temp\\' - jitter.vm.vm_set_mem(buf, func(l + '\x00')) + jitter.vm.set_mem(buf, func(l + '\x00')) jitter.func_ret_stdcall(ret_ad, len(l)) @@ -2776,7 +2776,7 @@ def kernel32_GetTempFileNameA(jitter): else: path = "xxx" fname = path + "\\" + "temp%.4d" % temp_num + "." + ext - jitter.vm.vm_set_mem(buf, fname) + jitter.vm.set_mem(buf, fname) jitter.func_ret_stdcall(ret_ad, 0) @@ -2858,7 +2858,7 @@ def kernel32_FindFirstFileA(jitter): fname = winobjs.find_data.findnext(h) fdata = win32_find_data(cfilename=fname) - jitter.vm.vm_set_mem(pfindfiledata, fdata.toStruct()) + jitter.vm.set_mem(pfindfiledata, fdata.toStruct()) jitter.func_ret_stdcall(ret_ad, h) @@ -2872,7 +2872,7 @@ def kernel32_FindNextFileA(jitter): else: ret = 1 fdata = win32_find_data(cfilename=fname) - jitter.vm.vm_set_mem(pfindfiledata, fdata.toStruct()) + jitter.vm.set_mem(pfindfiledata, fdata.toStruct()) jitter.func_ret_stdcall(ret_ad, ret) @@ -2881,7 +2881,7 @@ def kernel32_GetNativeSystemInfo(jitter): ret_ad, args = jitter.func_args_stdcall(1) sys_ptr, = args sysinfo = systeminfo() - jitter.vm.vm_set_mem(sys_ptr, sysinfo.pack()) + jitter.vm.set_mem(sys_ptr, sysinfo.pack()) jitter.func_ret_stdcall(ret_ad, 0) @@ -2919,7 +2919,7 @@ def msvcrt__ultow(jitter): if not radix in [10, 16, 20]: TODO_TEST s = int2base(value, radix) - jitter.vm.vm_set_mem(p, set_str_unic(s + "\x00")) + jitter.vm.set_mem(p, set_str_unic(s + "\x00")) jitter.func_ret_cdecl(ret_ad, p) @@ -2941,7 +2941,7 @@ def msvcrt_myfopen(jitter, func): dwsize = 0x20 alloc_addr = alloc_mem(jitter, dwsize) pp = pck32(0x11112222)+pck32(0)+pck32(0)+pck32(0)+pck32(eax)#pdw(0x11112222) - jitter.vm.vm_set_mem(alloc_addr, pp) + jitter.vm.set_mem(alloc_addr, pp) else: diff --git a/miasm2/jitter/os_dep/win_api_x86_32_seh.py b/miasm2/jitter/os_dep/win_api_x86_32_seh.py index 1a28977d..8075a284 100644 --- a/miasm2/jitter/os_dep/win_api_x86_32_seh.py +++ b/miasm2/jitter/os_dep/win_api_x86_32_seh.py @@ -334,7 +334,7 @@ def create_modules_chain(myjit, modules_name): m_o += "\x00".join(bpath) + "\x00" m_o += "\x00" * 3 # out += m_o - myjit.vm.vm_set_mem(addr, m_o) + myjit.vm.set_mem(addr, m_o) return modules_info @@ -380,7 +380,7 @@ def fix_InLoadOrderModuleList(myjit, module_info): e, bname, addr = olist[i] p_e, p_bname, p_addr = olist[(i - 1) % len(olist)] n_e, n_bname, n_addr = olist[(i + 1) % len(olist)] - myjit.vm.vm_set_mem(addr + 0, pck32(n_addr) + pck32(p_addr)) + myjit.vm.set_mem(addr + 0, pck32(n_addr) + pck32(p_addr)) def fix_InMemoryOrderModuleList(myjit, module_info): @@ -424,7 +424,7 @@ def fix_InMemoryOrderModuleList(myjit, module_info): e, bname, addr = olist[i] p_e, p_bname, p_addr = olist[(i - 1) % len(olist)] n_e, n_bname, n_addr = olist[(i + 1) % len(olist)] - myjit.vm.vm_set_mem( + myjit.vm.set_mem( addr + 0x8, pck32(n_addr + 0x8) + pck32(p_addr + 0x8)) @@ -460,7 +460,7 @@ def fix_InInitializationOrderModuleList(myjit, module_info): e, bname, addr = olist[i] p_e, p_bname, p_addr = olist[(i - 1) % len(olist)] n_e, n_bname, n_addr = olist[(i + 1) % len(olist)] - myjit.vm.vm_set_mem( + myjit.vm.set_mem( addr + 0x10, pck32(n_addr + 0x10) + pck32(p_addr + 0x10)) @@ -468,10 +468,10 @@ def add_process_env(myjit): env_str = 'ALLUSEESPROFILE=C:\\Documents and Settings\\All Users\x00' env_str = '\x00'.join(env_str) env_str += "\x00" * 0x10 - myjit.vm.vm_add_memory_page(process_environment_address, + myjit.vm.add_memory_page(process_environment_address, PAGE_READ | PAGE_WRITE, env_str) - myjit.vm.vm_set_mem(process_environment_address, env_str) + myjit.vm.set_mem(process_environment_address, env_str) def add_process_parameters(myjit): @@ -479,9 +479,9 @@ def add_process_parameters(myjit): o += pck32(0x1000) # size o += "E" * (0x48 - len(o)) o += pck32(process_environment_address) - myjit.vm.vm_add_memory_page(process_parameters_address, - PAGE_READ | PAGE_WRITE, - o) + myjit.vm.add_memory_page(process_parameters_address, + PAGE_READ | PAGE_WRITE, + o) def build_fake_InLoadOrderModuleList(modules_name): @@ -595,15 +595,15 @@ all_seh_ad = dict([(x, None) def init_seh(myjit): global seh_count seh_count = 0 - # myjit.vm.vm_add_memory_page(tib_address, PAGE_READ | PAGE_WRITE, + # myjit.vm.add_memory_page(tib_address, PAGE_READ | PAGE_WRITE, # p(default_seh) + p(0) * 11 + p(peb_address)) - myjit.vm.vm_add_memory_page( + myjit.vm.add_memory_page( FS_0_AD, PAGE_READ | PAGE_WRITE, build_fake_teb()) - # myjit.vm.vm_add_memory_page(peb_address, PAGE_READ | PAGE_WRITE, p(0) * + # myjit.vm.add_memory_page(peb_address, PAGE_READ | PAGE_WRITE, p(0) * # 3 + p(peb_ldr_data_address)) - myjit.vm.vm_add_memory_page( + myjit.vm.add_memory_page( peb_address, PAGE_READ | PAGE_WRITE, build_fake_peb()) - # myjit.vm.vm_add_memory_page(peb_ldr_data_address, PAGE_READ | + # myjit.vm.add_memory_page(peb_ldr_data_address, PAGE_READ | # PAGE_WRITE, p(0) * 3 + p(in_load_order_module_list_address) + p(0) * # 0x20) @@ -613,7 +613,7 @@ def init_seh(myjit): ldr_data += "\x00"*(InLoadOrderModuleList_offset - len(ldr_data)) ldr_data += build_fake_InLoadOrderModuleList(loaded_modules) """ - myjit.vm.vm_add_memory_page( + myjit.vm.add_memory_page( LDR_AD, PAGE_READ | PAGE_WRITE, "\x00" * MAX_MODULES * 0x1000) module_info = create_modules_chain(myjit, loaded_modules) fix_InLoadOrderModuleList(myjit, module_info) @@ -621,23 +621,23 @@ def init_seh(myjit): fix_InInitializationOrderModuleList(myjit, module_info) ldr_data = build_fake_ldr_data(module_info) - myjit.vm.vm_set_mem(LDR_AD, ldr_data) + myjit.vm.set_mem(LDR_AD, ldr_data) add_process_env(myjit) add_process_parameters(myjit) - # myjit.vm.vm_add_memory_page(in_load_order_module_list_address, + # myjit.vm.add_memory_page(in_load_order_module_list_address, # PAGE_READ | PAGE_WRITE, p(0) * 40) - # myjit.vm.vm_add_memory_page(in_load_order_module_list_address, + # myjit.vm.add_memory_page(in_load_order_module_list_address, # PAGE_READ | PAGE_WRITE, build_fake_inordermodule(loaded_modules)) - myjit.vm.vm_add_memory_page(default_seh, PAGE_READ | PAGE_WRITE, pck32( + myjit.vm.add_memory_page(default_seh, PAGE_READ | PAGE_WRITE, pck32( 0xffffffff) + pck32(0x41414141) + pck32(0x42424242)) - myjit.vm.vm_add_memory_page( + myjit.vm.add_memory_page( context_address, PAGE_READ | PAGE_WRITE, '\x00' * 0x2cc) - myjit.vm.vm_add_memory_page( + myjit.vm.add_memory_page( exception_record_address, PAGE_READ | PAGE_WRITE, '\x00' * 200) - myjit.vm.vm_add_memory_page( + myjit.vm.add_memory_page( FAKE_SEH_B_AD, PAGE_READ | PAGE_WRITE, 0x10000 * "\x00") # http://www.codeproject.com/KB/system/inject2exe.aspx#RestorethefirstRegistersContext5_1 @@ -727,7 +727,7 @@ def free_seh_place(ad): def fake_seh_handler(myjit, except_code): global seh_count - regs = myjit.cpu.vm_get_gpreg() + regs = myjit.cpu.get_gpreg() print '-> exception at', hex(myjit.cpu.EIP), seh_count seh_count += 1 @@ -752,22 +752,22 @@ def fake_seh_handler(myjit, except_code): # seh = (get_memory_page_max_address_py()+0x1000)&0xfffff000 # Get current seh (fs:[0]) - seh_ptr = upck32(myjit.vm.vm_get_mem(tib_address, 4)) + seh_ptr = upck32(myjit.vm.get_mem(tib_address, 4)) # Retrieve seh fields old_seh, eh, safe_place = struct.unpack( - 'III', myjit.vm.vm_get_mem(seh_ptr, 0xc)) + 'III', myjit.vm.get_mem(seh_ptr, 0xc)) print '-> seh_ptr', hex(seh_ptr), '-> { old_seh', print hex(old_seh), 'eh', hex(eh), 'safe_place', hex(safe_place), '}' # print '-> write SEH at', hex(seh&0xffffffff) # Write current seh - # myjit.vm.vm_add_memory_page(seh, PAGE_READ | PAGE_WRITE, p(old_seh) + + # myjit.vm.add_memory_page(seh, PAGE_READ | PAGE_WRITE, p(old_seh) + # p(eh) + p(safe_place) + p(0x99999999)) # Write context - myjit.vm.vm_set_mem(context_address, ctxt) + myjit.vm.set_mem(context_address, ctxt) # Write exception_record @@ -784,28 +784,28 @@ def fake_seh_handler(myjit, except_code): } EXCEPTION_RECORD, *PEXCEPTION_RECORD; """ - myjit.vm.vm_set_mem(exception_record_address, pck32(except_code) + - pck32(0) + pck32(0) + pck32(myjit.cpu.EIP) + - pck32(0) + pck32(0)) + myjit.vm.set_mem(exception_record_address, pck32(except_code) + + pck32(0) + pck32(0) + pck32(myjit.cpu.EIP) + + pck32(0) + pck32(0)) # Prepare the stack - myjit.vm_push_uint32_t(context_address) # Context - myjit.vm_push_uint32_t(seh_ptr) # SEH - myjit.vm_push_uint32_t(exception_record_address) # ExceptRecords - myjit.vm_push_uint32_t(return_from_exception) # Ret address + myjit.push_uint32_t(context_address) # Context + myjit.push_uint32_t(seh_ptr) # SEH + myjit.push_uint32_t(exception_record_address) # ExceptRecords + myjit.push_uint32_t(return_from_exception) # Ret address # Set fake new current seh for exception fake_seh_ad = get_free_seh_place() print hex(fake_seh_ad) - myjit.vm.vm_set_mem(fake_seh_ad, pck32(seh_ptr) + pck32( + myjit.vm.set_mem(fake_seh_ad, pck32(seh_ptr) + pck32( 0xaaaaaaaa) + pck32(0xaaaaaabb) + pck32(0xaaaaaacc)) - myjit.vm.vm_set_mem(tib_address, pck32(fake_seh_ad)) + myjit.vm.set_mem(tib_address, pck32(fake_seh_ad)) dump_seh(myjit) print '-> jumping at', hex(eh) - myjit.vm.vm_set_exception(0) - myjit.cpu.vm_set_exception(0) + myjit.vm.set_exception(0) + myjit.cpu.set_exception(0) # XXX set ebx to nul? myjit.cpu.EBX = 0 @@ -818,14 +818,14 @@ fake_seh_handler.base = FAKE_SEH_B_AD def dump_seh(myjit): print 'dump_seh:' print '-> tib_address:', hex(tib_address) - cur_seh_ptr = upck32(myjit.vm.vm_get_mem(tib_address, 4)) + cur_seh_ptr = upck32(myjit.vm.get_mem(tib_address, 4)) indent = 1 loop = 0 while True: if loop > 5: print "too many seh, quit" return - prev_seh, eh = struct.unpack('II', myjit.vm.vm_get_mem(cur_seh_ptr, 8)) + prev_seh, eh = struct.unpack('II', myjit.vm.get_mem(cur_seh_ptr, 8)) print '\t' * indent + 'seh_ptr:', hex(cur_seh_ptr), print ' -> { prev_seh:', hex(prev_seh), 'eh:', hex(eh), '}' if prev_seh in [0xFFFFFFFF, 0]: @@ -836,10 +836,10 @@ def dump_seh(myjit): def set_win_fs_0(myjit, fs=4): - regs = myjit.cpu.vm_get_gpreg() + regs = myjit.cpu.get_gpreg() regs['FS'] = 0x4 - myjit.cpu.vm_set_gpreg(regs) - myjit.cpu.vm_set_segm_base(regs['FS'], FS_0_AD) + myjit.cpu.set_gpreg(regs) + myjit.cpu.set_segm_base(regs['FS'], FS_0_AD) segm_to_do = set([x86_regs.FS]) return segm_to_do @@ -857,15 +857,15 @@ def return_from_seh(myjit): "Handle return after a call to fake seh handler" # Get current context - myjit.cpu.ESP = upck32(myjit.vm.vm_get_mem(context_address + 0xc4, 4)) + myjit.cpu.ESP = upck32(myjit.vm.get_mem(context_address + 0xc4, 4)) logging.info('-> new esp: %x' % myjit.cpu.ESP) # Rebuild SEH - old_seh = upck32(myjit.vm.vm_get_mem(tib_address, 4)) - new_seh = upck32(myjit.vm.vm_get_mem(old_seh, 4)) + old_seh = upck32(myjit.vm.get_mem(tib_address, 4)) + new_seh = upck32(myjit.vm.get_mem(old_seh, 4)) logging.info('-> old seh: %x' % old_seh) logging.info('-> new seh: %x' % new_seh) - myjit.vm.vm_set_mem(tib_address, pck32(new_seh)) + myjit.vm.set_mem(tib_address, pck32(new_seh)) dump_seh(myjit) @@ -879,7 +879,7 @@ def return_from_seh(myjit): print '-> context:', hex(ctxt_ptr) # Get registers changes - ctxt_str = myjit.vm.vm_get_mem(ctxt_ptr, 0x2cc) + ctxt_str = myjit.vm.get_mem(ctxt_ptr, 0x2cc) regs = ctxt2regs(ctxt_str) myjit.pc = regs["EIP"] for reg_name, reg_value in regs.items(): diff --git a/miasm2/jitter/vm_mngr_py.c b/miasm2/jitter/vm_mngr_py.c index 8d5faacb..1462050b 100644 --- a/miasm2/jitter/vm_mngr_py.c +++ b/miasm2/jitter/vm_mngr_py.c @@ -760,60 +760,60 @@ static PyMemberDef VmMngr_members[] = { }; static PyMethodDef VmMngr_methods[] = { - {"vm_init_memory_page_pool", (PyCFunction)vm_init_memory_page_pool, METH_VARARGS, + {"init_memory_page_pool", (PyCFunction)vm_init_memory_page_pool, METH_VARARGS, "X"}, - {"vm_init_memory_breakpoint", (PyCFunction)vm_init_memory_breakpoint, METH_VARARGS, + {"init_memory_breakpoint", (PyCFunction)vm_init_memory_breakpoint, METH_VARARGS, "X"}, - {"vm_init_code_bloc_pool",(PyCFunction)vm_init_code_bloc_pool, METH_VARARGS, + {"init_code_bloc_pool",(PyCFunction)vm_init_code_bloc_pool, METH_VARARGS, "X"}, - {"vm_set_mem_access", (PyCFunction)vm_set_mem_access, METH_VARARGS, + {"set_mem_access", (PyCFunction)vm_set_mem_access, METH_VARARGS, "X"}, - {"vm_set_mem", (PyCFunction)vm_set_mem, METH_VARARGS, + {"set_mem", (PyCFunction)vm_set_mem, METH_VARARGS, "X"}, - {"vm_set_automod_cb", (PyCFunction)vm_set_automod_cb, METH_VARARGS, + {"set_automod_cb", (PyCFunction)vm_set_automod_cb, METH_VARARGS, "X"}, - {"vm_set_addr2obj", (PyCFunction)vm_set_addr2obj, METH_VARARGS, + {"set_addr2obj", (PyCFunction)vm_set_addr2obj, METH_VARARGS, "X"}, - {"vm_add_code_bloc",(PyCFunction)vm_add_code_bloc, METH_VARARGS, + {"add_code_bloc",(PyCFunction)vm_add_code_bloc, METH_VARARGS, "X"}, - {"vm_exec_bloc",(PyCFunction)vm_exec_bloc, METH_VARARGS, + {"exec_bloc",(PyCFunction)vm_exec_bloc, METH_VARARGS, "X"}, - {"vm_exec_blocs",(PyCFunction)vm_exec_blocs, METH_VARARGS, + {"exec_blocs",(PyCFunction)vm_exec_blocs, METH_VARARGS, "X"}, - {"vm_get_mem", (PyCFunction)vm_get_mem, METH_VARARGS, + {"get_mem", (PyCFunction)vm_get_mem, METH_VARARGS, "X"}, - {"vm_add_memory_page",(PyCFunction)vm_add_memory_page, METH_VARARGS, + {"add_memory_page",(PyCFunction)vm_add_memory_page, METH_VARARGS, "X"}, - {"vm_add_memory_breakpoint",(PyCFunction)vm_add_memory_breakpoint, METH_VARARGS, + {"add_memory_breakpoint",(PyCFunction)vm_add_memory_breakpoint, METH_VARARGS, "X"}, - {"vm_remove_memory_breakpoint",(PyCFunction)vm_remove_memory_breakpoint, METH_VARARGS, + {"remove_memory_breakpoint",(PyCFunction)vm_remove_memory_breakpoint, METH_VARARGS, "X"}, - {"vm_set_exception", (PyCFunction)vm_set_exception, METH_VARARGS, + {"set_exception", (PyCFunction)vm_set_exception, METH_VARARGS, "X"}, - {"vm_dump_memory_page_pool", (PyCFunction)vm_dump_memory_page_pool, METH_VARARGS, + {"dump_memory_page_pool", (PyCFunction)vm_dump_memory_page_pool, METH_VARARGS, "X"}, - {"vm_dump_memory_breakpoint", (PyCFunction)vm_dump_memory_breakpoint, METH_VARARGS, + {"dump_memory_breakpoint", (PyCFunction)vm_dump_memory_breakpoint, METH_VARARGS, "X"}, - {"vm_get_all_memory",(PyCFunction)vm_get_all_memory, METH_VARARGS, + {"get_all_memory",(PyCFunction)vm_get_all_memory, METH_VARARGS, "X"}, - {"vm_reset_memory_page_pool", (PyCFunction)vm_reset_memory_page_pool, METH_VARARGS, + {"reset_memory_page_pool", (PyCFunction)vm_reset_memory_page_pool, METH_VARARGS, "X"}, - {"vm_reset_memory_breakpoint", (PyCFunction)vm_reset_memory_breakpoint, METH_VARARGS, + {"reset_memory_breakpoint", (PyCFunction)vm_reset_memory_breakpoint, METH_VARARGS, "X"}, - {"vm_reset_code_bloc_pool", (PyCFunction)vm_reset_code_bloc_pool, METH_VARARGS, + {"reset_code_bloc_pool", (PyCFunction)vm_reset_code_bloc_pool, METH_VARARGS, "X"}, {"set_alarm", (PyCFunction)set_alarm, METH_VARARGS, "X"}, - {"vm_call_pyfunc_from_globals",(PyCFunction)vm_call_pyfunc_from_globals, METH_VARARGS, + {"call_pyfunc_from_globals",(PyCFunction)vm_call_pyfunc_from_globals, METH_VARARGS, "X"}, - {"vm_get_exception",(PyCFunction)vm_get_exception, METH_VARARGS, + {"get_exception",(PyCFunction)vm_get_exception, METH_VARARGS, "X"}, - {"vm_get_exception",(PyCFunction)vm_get_exception, METH_VARARGS, + {"get_exception",(PyCFunction)vm_get_exception, METH_VARARGS, "X"}, - {"vm_get_last_write_ad", (PyCFunction)vm_get_last_write_ad, METH_VARARGS, + {"get_last_write_ad", (PyCFunction)vm_get_last_write_ad, METH_VARARGS, "X"}, - {"vm_get_last_write_size",(PyCFunction)vm_get_last_write_size, METH_VARARGS, + {"get_last_write_size",(PyCFunction)vm_get_last_write_size, METH_VARARGS, "X"}, {NULL} /* Sentinel */ |