def __init__(self, custom_methods, *args, **kwargs): from miasm.jitter.loader.elf import libimp_elf from miasm.os_dep import linux_stdlib methods = linux_stdlib.__dict__ methods.update(custom_methods) super(OS_Linux_str, self).__init__(methods, *args, **kwargs) # Import manager libs = libimp_elf() self.libs = libs data = open(self.fname, "rb").read() self.options.load_base_addr = int(self.options.load_base_addr, 0) self.jitter.vm.add_memory_page(self.options.load_base_addr, PAGE_READ | PAGE_WRITE, data, "Initial Str") # Library calls handler self.jitter.add_lib_handler(libs, methods) linux_stdlib.ABORT_ADDR = self.CALL_FINISH_ADDR # Arguments self.argv = [self.PROGRAM_PATH] if self.options.command_line: self.argv += self.options.command_line self.envp = self.options.environment_vars
def __init__(self, custom_methods, *args, **kwargs): from miasm.jitter.loader.elf import libimp_elf from miasm.os_dep import linux_stdlib methods = linux_stdlib.__dict__ methods.update(custom_methods) super(OS_Linux_str, self).__init__(methods, *args, **kwargs) # Import manager libs = libimp_elf() self.libs = libs data = open(self.fname, "rb").read() self.options.load_base_addr = int(self.options.load_base_addr, 0) self.jitter.vm.add_memory_page( self.options.load_base_addr, PAGE_READ | PAGE_WRITE, data, "Initial Str" ) # Library calls handler self.jitter.add_lib_handler(libs, methods) linux_stdlib.ABORT_ADDR = self.CALL_FINISH_ADDR # Arguments self.argv = [self.PROGRAM_PATH] if self.options.command_line: self.argv += self.options.command_line self.envp = self.options.environment_vars
def __init__(self, custom_methods, *args, **kwargs): from miasm.jitter.loader.elf import vm_load_elf, preload_elf, libimp_elf from miasm.os_dep import linux_stdlib methods = linux_stdlib.__dict__ methods.update(custom_methods) super(OS_Linux, self).__init__(methods, *args, **kwargs) # Import manager self.libs = libimp_elf() with open(self.fname, "rb") as fstream: self.elf = vm_load_elf(self.jitter.vm, fstream.read(), name=self.fname, **kwargs) preload_elf(self.jitter.vm, self.elf, self.libs) self.entry_point = self.elf.Ehdr.entry # Library calls handler self.jitter.add_lib_handler(self.libs, methods) linux_stdlib.ABORT_ADDR = self.CALL_FINISH_ADDR # Arguments self.argv = [self.PROGRAM_PATH] if self.options.command_line: self.argv += self.options.command_line self.envp = self.options.environment_vars
def __init__(self, custom_methods, *args, **kwargs): from miasm.jitter.loader.elf import vm_load_elf, preload_elf, libimp_elf from miasm.os_dep import linux_stdlib methods = linux_stdlib.__dict__ methods.update(custom_methods) super(OS_Linux, self).__init__(methods, *args, **kwargs) # Import manager self.libs = libimp_elf() with open(self.fname, "rb") as fstream: self.elf = vm_load_elf( self.jitter.vm, fstream.read(), name=self.fname, **kwargs ) preload_elf(self.jitter.vm, self.elf, self.libs) self.entry_point = self.elf.Ehdr.entry # Library calls handler self.jitter.add_lib_handler(self.libs, methods) linux_stdlib.ABORT_ADDR = self.CALL_FINISH_ADDR # Arguments self.argv = [self.PROGRAM_PATH] if self.options.command_line: self.argv += self.options.command_line self.envp = self.options.environment_vars