diff options
Diffstat (limited to '')
| -rw-r--r-- | example/extract_pe_ressources.py | 2 | ||||
| -rw-r--r-- | example/unpack_upx.py | 2 | ||||
| -rw-r--r-- | miasm/tools/emul_lib/libcodenat_interface.c | 35 | ||||
| -rw-r--r-- | miasm/tools/pe_helper.py | 2 |
4 files changed, 38 insertions, 3 deletions
diff --git a/example/extract_pe_ressources.py b/example/extract_pe_ressources.py index c21f999c..71d8e226 100644 --- a/example/extract_pe_ressources.py +++ b/example/extract_pe_ressources.py @@ -15,7 +15,7 @@ def extract_res(res, name_o = "", num = 0, lvl=-1): num += 1 if x.name_s: - name = name_o[:]+repr(x.name_s) + name = name_o[:]+repr(x.name_s.value[::2]) else: name = name_o[:] diff --git a/example/unpack_upx.py b/example/unpack_upx.py index cf1e2357..e7ea4b77 100644 --- a/example/unpack_upx.py +++ b/example/unpack_upx.py @@ -273,7 +273,7 @@ for s in e.SHList: st[s.offset] = e.virt[ad1:ad2] e.content = str(st) -e.DirRes = pe_init.DirRes(e) +e.DirRes = pe.DirRes(e) #e.DirImport.impdesc = None print repr(e.DirImport.impdesc) new_dll = runtime_dll.gen_new_lib(e) diff --git a/miasm/tools/emul_lib/libcodenat_interface.c b/miasm/tools/emul_lib/libcodenat_interface.c index a45e2e9c..6bb04fb1 100644 --- a/miasm/tools/emul_lib/libcodenat_interface.c +++ b/miasm/tools/emul_lib/libcodenat_interface.c @@ -112,6 +112,31 @@ PyObject* _vm_get_gpreg(void) PyDict_SetItemString(dict, "eip", o); Py_DECREF(o); + + o = PyInt_FromLong((long)vmcpu.zf); + PyDict_SetItemString(dict, "zf", o); + Py_DECREF(o); + o = PyInt_FromLong((long)vmcpu.nf); + PyDict_SetItemString(dict, "nf", o); + Py_DECREF(o); + o = PyInt_FromLong((long)vmcpu.pf); + PyDict_SetItemString(dict, "pf", o); + Py_DECREF(o); + o = PyInt_FromLong((long)vmcpu.of); + PyDict_SetItemString(dict, "of", o); + Py_DECREF(o); + o = PyInt_FromLong((long)vmcpu.cf); + PyDict_SetItemString(dict, "cf", o); + Py_DECREF(o); + o = PyInt_FromLong((long)vmcpu.af); + PyDict_SetItemString(dict, "af", o); + Py_DECREF(o); + o = PyInt_FromLong((long)vmcpu.df); + PyDict_SetItemString(dict, "df", o); + Py_DECREF(o); + + + return dict; } @@ -124,6 +149,16 @@ reg_dict gpreg_dict[] = { {.name = "eax", .ptr = &(vmcpu.eax)}, {.name = "esp", .ptr = &(vmcpu.esp)}, {.name = "ebp", .ptr = &(vmcpu.ebp)}, {.name = "eip", .ptr = &(vmcpu.eip)}, + + {.name = "zf", .ptr = &(vmcpu.zf)}, + {.name = "nf", .ptr = &(vmcpu.nf)}, + {.name = "pf", .ptr = &(vmcpu.pf)}, + {.name = "of", .ptr = &(vmcpu.of)}, + {.name = "cf", .ptr = &(vmcpu.cf)}, + {.name = "af", .ptr = &(vmcpu.af)}, + {.name = "df", .ptr = &(vmcpu.df)}, + + }; PyObject* _vm_set_gpreg(PyObject *dict) diff --git a/miasm/tools/pe_helper.py b/miasm/tools/pe_helper.py index 8e969c70..a63c2b99 100644 --- a/miasm/tools/pe_helper.py +++ b/miasm/tools/pe_helper.py @@ -578,7 +578,7 @@ def preload_lib(e, runtime_lib, patch_vm_imp = True): libname_s = canon_libname_libfunc(libname, libfunc) dyn_funcs[libname_s] = ad_libfunc if patch_vm_imp: - to_c_helper.vm_set_mem(ad, struct.pack(cstruct.size2type[e.wsize], ad_libfunc)) + to_c_helper.vm_set_mem(ad, struct.pack(cstruct.size2type[e._wsize], ad_libfunc)) return dyn_funcs |