diff options
Diffstat (limited to 'example/jitter/unpack_upx.py')
| -rw-r--r-- | example/jitter/unpack_upx.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py index 6bcef1ab..5d862dd1 100644 --- a/example/jitter/unpack_upx.py +++ b/example/jitter/unpack_upx.py @@ -1,3 +1,4 @@ +from __future__ import print_function import os import logging from pdb import pm @@ -12,12 +13,12 @@ def kernel32_GetProcAddress(jitter): # When the function is called, EBX is a pointer to the destination buffer dst_ad = jitter.cpu.EBX - logging.info('EBX ' + hex(dst_ad)) + logging.error('EBX ' + hex(dst_ad)) # Handle ordinal imports fname = (args.fname if args.fname < 0x10000 else jitter.get_str_ansi(args.fname)) - logging.info(fname) + logging.error(fname) # Get the generated address of the library, and store it in memory to # dst_ad @@ -38,6 +39,7 @@ parser.add_argument("--graph", action="store_true") options = parser.parse_args() options.load_hdr = True + sb = Sandbox_Win_x86_32(options.filename, options, globals(), parse_reloc=False) @@ -48,7 +50,7 @@ else: logging.basicConfig(level=logging.WARNING) if options.verbose is True: - print sb.jitter.vm + print(sb.jitter.vm) # Ensure there is one and only one leave (for OEP discovering) mdis = sb.machine.dis_engine(sb.jitter.bs) @@ -70,7 +72,7 @@ if options.graph is True: if options.verbose is True: - print sb.jitter.vm + print(sb.jitter.vm) def update_binary(jitter): @@ -114,4 +116,4 @@ sb.pe.NThdr.optentries[pe.DIRECTORY_ENTRY_DELAY_IMPORT].rva = 0 bname, fname = os.path.split(options.filename) fname = os.path.join(bname, fname.replace('.', '_')) -open(fname + '_unupx.bin', 'w').write(str(sb.pe)) +open(fname + '_unupx.bin', 'wb').write(bytes(sb.pe)) |