miasm
Reverse engineering framework
|
Classes | |
class | LoadedModules |
Functions | |
def | build_teb (jitter, teb_address) |
def | build_peb (jitter, peb_address) |
def | build_ldr_data (jitter, modules_info) |
def | create_modules_chain (jitter, name2module) |
def | set_link_list_entry (jitter, loaded_modules, modules_info, offset) |
def | fix_InLoadOrderModuleList (jitter, modules_info) |
def | fix_InMemoryOrderModuleList (jitter, modules_info) |
def | fix_InInitializationOrderModuleList (jitter, modules_info) |
def | add_process_env (jitter) |
def | add_process_parameters (jitter) |
def | init_seh (jitter) |
def | regs2ctxt (jitter, context_address) |
def | ctxt2regs (jitter, ctxt_ptr) |
def | fake_seh_handler (jitter, except_code, previous_seh=None) |
def | dump_seh (jitter) |
def | set_win_fs_0 (jitter, fs=4) |
def | return_from_seh (jitter) |
def miasm.os_dep.win_api_x86_32_seh.add_process_env | ( | jitter | ) |
Build a process environment structure @jitter: jitter instance
def miasm.os_dep.win_api_x86_32_seh.add_process_parameters | ( | jitter | ) |
Build a process parameters structure @jitter: jitter instance
def miasm.os_dep.win_api_x86_32_seh.build_ldr_data | ( | jitter, | |
modules_info | |||
) |
Build Loader information using following structure: +0x000 Length : Uint4B +0x004 Initialized : UChar +0x008 SsHandle : Ptr32 Void +0x00c InLoadOrderModuleList : _LIST_ENTRY +0x014 InMemoryOrderModuleList : _LIST_ENTRY +0x01C InInitializationOrderModuleList : _LIST_ENTRY # dummy dll base +0x024 DllBase : Ptr32 Void @jitter: jitter instance @modules_info: LoadedModules instance
def miasm.os_dep.win_api_x86_32_seh.build_peb | ( | jitter, | |
peb_address | |||
) |
Build PEB information using following structure: @jitter: jitter instance @peb_address: the PEB address
def miasm.os_dep.win_api_x86_32_seh.build_teb | ( | jitter, | |
teb_address | |||
) |
Build TEB information using following structure: @jitter: jitter instance @teb_address: the TEB address
def miasm.os_dep.win_api_x86_32_seh.create_modules_chain | ( | jitter, | |
name2module | |||
) |
Create the modules entries. Those modules are not linked in this function. @jitter: jitter instance @name2module: dict containing association between name and its pe instance
def miasm.os_dep.win_api_x86_32_seh.ctxt2regs | ( | jitter, | |
ctxt_ptr | |||
) |
Restore x86_32 registers from an exception context @ctxt: the serialized context @jitter: jitload instance
def miasm.os_dep.win_api_x86_32_seh.dump_seh | ( | jitter | ) |
Walk and dump the SEH entries @jitter: jitter instance
def miasm.os_dep.win_api_x86_32_seh.fake_seh_handler | ( | jitter, | |
except_code, | |||
previous_seh = None |
|||
) |
Create an exception context @jitter: jitter instance @except_code: x86 exception code @previous_seh: (optional) last SEH address when multiple SEH are used
def miasm.os_dep.win_api_x86_32_seh.fix_InInitializationOrderModuleList | ( | jitter, | |
modules_info | |||
) |
Fix InInitializationOrderModuleList double link list. First module is the ntdll, then kernel32. @jitter: the jitter instance @modules_info: the LoadedModules instance
def miasm.os_dep.win_api_x86_32_seh.fix_InLoadOrderModuleList | ( | jitter, | |
modules_info | |||
) |
Fix InLoadOrderModuleList double link list. First module is the main pe, then ntdll, kernel32. @jitter: the jitter instance @modules_info: the LoadedModules instance
def miasm.os_dep.win_api_x86_32_seh.fix_InMemoryOrderModuleList | ( | jitter, | |
modules_info | |||
) |
Fix InMemoryOrderLinks double link list. First module is the main pe, then ntdll, kernel32. @jitter: the jitter instance @modules_info: the LoadedModules instance
def miasm.os_dep.win_api_x86_32_seh.init_seh | ( | jitter | ) |
Build the modules entries and create double links @jitter: jitter instance
def miasm.os_dep.win_api_x86_32_seh.regs2ctxt | ( | jitter, | |
context_address | |||
) |
Build x86_32 cpu context for exception handling @jitter: jitload instance
def miasm.os_dep.win_api_x86_32_seh.return_from_seh | ( | jitter | ) |
Handle the return from an exception handler @jitter: jitter instance
def miasm.os_dep.win_api_x86_32_seh.set_link_list_entry | ( | jitter, | |
loaded_modules, | |||
modules_info, | |||
offset | |||
) |
def miasm.os_dep.win_api_x86_32_seh.set_win_fs_0 | ( | jitter, | |
fs = 4 |
|||
) |
Set FS segment selector and create its corresponding segment @jitter: jitter instance @fs: segment selector value
miasm.os_dep.win_api_x86_32_seh.console_handler = logging.StreamHandler() |
int miasm.os_dep.win_api_x86_32_seh.DEFAULT_SEH = 0x7ffff000 |
int miasm.os_dep.win_api_x86_32_seh.EXCEPTION_ACCESS_VIOLATION = 0xc0000005 |
int miasm.os_dep.win_api_x86_32_seh.EXCEPTION_BREAKPOINT = 0x80000003 |
int miasm.os_dep.win_api_x86_32_seh.EXCEPTION_ILLEGAL_INSTRUCTION = 0xc000001d |
int miasm.os_dep.win_api_x86_32_seh.EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 |
int miasm.os_dep.win_api_x86_32_seh.EXCEPTION_PRIV_INSTRUCTION = 0xc0000096 |
int miasm.os_dep.win_api_x86_32_seh.EXCEPTION_SINGLE_STEP = 0x80000004 |
int miasm.os_dep.win_api_x86_32_seh.InInitializationOrderModuleList_address = LDR_AD + \ |
int miasm.os_dep.win_api_x86_32_seh.InInitializationOrderModuleList_offset = 0x1ee0 |
int miasm.os_dep.win_api_x86_32_seh.InLoadOrderModuleList_address = LDR_AD + \ |
int miasm.os_dep.win_api_x86_32_seh.InLoadOrderModuleList_offset = 0x1ee0 + \ |
int miasm.os_dep.win_api_x86_32_seh.LDR_AD = 0x340000 |
miasm.os_dep.win_api_x86_32_seh.log = logging.getLogger("seh_helper") |
miasm.os_dep.win_api_x86_32_seh.main_pe = None |
string miasm.os_dep.win_api_x86_32_seh.main_pe_name = "c:\\xxx\\toto.exe" |
int miasm.os_dep.win_api_x86_32_seh.MAX_MODULES = 0x40 |
int miasm.os_dep.win_api_x86_32_seh.MAX_SEH = 5 |
int miasm.os_dep.win_api_x86_32_seh.modules_list_offset = 0x1f00 |
list miasm.os_dep.win_api_x86_32_seh.name2module = [] |
int miasm.os_dep.win_api_x86_32_seh.PEB_AD = 0x7ffdf000 |
int miasm.os_dep.win_api_x86_32_seh.peb_address = PEB_AD |
int miasm.os_dep.win_api_x86_32_seh.peb_ldr_data_address = LDR_AD + peb_ldr_data_offset |
int miasm.os_dep.win_api_x86_32_seh.peb_ldr_data_offset = 0x1ea0 |
int miasm.os_dep.win_api_x86_32_seh.process_environment_address = 0x10000 |
int miasm.os_dep.win_api_x86_32_seh.process_parameters_address = 0x200000 |
int miasm.os_dep.win_api_x86_32_seh.return_from_exception = 0x6eadbeef |
int miasm.os_dep.win_api_x86_32_seh.seh_count = 0 |
int miasm.os_dep.win_api_x86_32_seh.tib_address = 0x7ff70000 |