From 4dc802e3544e669cfea1d6be8a01ca2a2600dfef Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Sat, 2 Nov 2019 22:24:23 +0100 Subject: Clear get_str_* API get_str_ansi decoded strings using utf8 and was blindly used for pure windows function (LoadLibraryA) and for stdlib functions (printf, strlen, ...) even if strlen does not use utf8... New API is: get_win_str_a/get_win_str_w and set_win_str_a/set_win_str_w for windows (respectively codepage1252/windows utf16) .Those functions should only be used in windows strings manipulations, so there are taken out of the jitter. get_c_str/set_c_str: as those functions are "classic" in OSes, they are keeped in the jitter. --- example/jitter/unpack_upx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'example/jitter/unpack_upx.py') diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py index 3b8125f4..baa6f0bb 100644 --- a/example/jitter/unpack_upx.py +++ b/example/jitter/unpack_upx.py @@ -5,6 +5,8 @@ from pdb import pm from miasm.loader import pe from miasm.analysis.sandbox import Sandbox_Win_x86_32 +from miasm.os_dep.common import get_win_str_a + # User defined methods def kernel32_GetProcAddress(jitter): @@ -17,7 +19,7 @@ def kernel32_GetProcAddress(jitter): # Handle ordinal imports fname = (args.fname if args.fname < 0x10000 - else jitter.get_str_ansi(args.fname)) + else get_win_str_a(jitter, args.fname)) logging.error(fname) # Get the generated address of the library, and store it in memory to -- cgit 1.4.1