@@ -73,16 +73,16 @@ def add_unicorn_hook(self, hook_type, callback, arg = None, start = 0, end = 0):
7373 def start (self , start , end ):
7474 self .uc .emu_start (start , end )
7575
76- class ShellEmu :
77- def __init__ (self , shellcode_filename , shellcode_bytes = '' , dump_filename = '' , exhaustive_loop_dump_frequency = 0x10000 ):
76+ class ShellcodeEmulator :
77+ def __init__ (self , shellcode_filename , shellcode_bytes = '' , dump_filename = '' , arch = 'AMD64' , exhaustive_loop_dump_frequency = 0x10000 ):
7878 self .shellcode_filename = shellcode_filename
7979 self .shellcode_bytes = shellcode_bytes
8080 self .exhaustive_loop_dump_frequency = exhaustive_loop_dump_frequency
8181 self .address_hit_map = {}
8282 self .last_code_address = 0
8383 self .last_code_size = 0
8484
85- self .emulator = Emulator (dump_filename = dump_filename )
85+ self .emulator = Emulator (dump_filename = dump_filename , arch = arch )
8686
8787 def instruction_callback (self , uc , address , size , user_data ):
8888 self .emulator .instruction .dump_context ()
@@ -151,6 +151,9 @@ def run(self, trace_self_modification = False, print_first_instructions = False)
151151 parser .add_option ("-d" , "--dump_filename" , dest = "dump_filename" ,
152152 type = "string" , default = "" , metavar = "DUMP_FILENAME" ,
153153 help = "A process dump file from normal Windows process" )
154+ parser .add_option ("-a" , "--arch" , dest = "arch" ,
155+ type = "string" , default = "AMD64" , metavar = "ARCH" ,
156+ help = "A process dump file from normal Windows process" )
154157 parser .add_option ("-l" , "--list_filename" , dest = "list_filename" ,
155158 type = "string" , default = "" , metavar = "LIST_FILENAME" ,
156159 help = "A list filename generated by IDA (this can be used instead of shellcode filename)" )
@@ -173,5 +176,5 @@ def run(self, trace_self_modification = False, print_first_instructions = False)
173176 parser .print_help ()
174177 sys .exit (0 )
175178
176- shell_emu = ShellEmu (shellcode_filename , shellcode_bytes = shellcode_bytes , dump_filename = options .dump_filename )
179+ shell_emu = ShellcodeEmulator (shellcode_filename , shellcode_bytes = shellcode_bytes , arch = options . arch , dump_filename = options .dump_filename )
177180 shell_emu .run (trace_self_modification = True , print_first_instructions = True )
0 commit comments