def __init__(self, core_instance): """ create a context_name and command_map as requested from the UnicornDbgModule :param core_instance: """ AbstractUnicornDbgModule.__init__(self, core_instance) self.capstone = None self.unicorn = None self.temp_brkpt = None self.context_name = "stepover_module" self.command_map = { 'so': { 'ref': "stepover", }, 'stepo': { 'ref': "stepover", }, 'stepover': { 'short': 'so,stepo', 'function': { "context": "stepover_module", "f": "stepover" }, 'help': 'stepover' }, }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.patches = [] self.context_name = "patches_module" self.command_map = { 'patch': { 'help': 'Patches', 'usage': 'patch [list|add|remove|toggle] [...]', 'sub_commands': { 'l': { 'ref': "list", }, 'a': { 'ref': "add", }, 'r': { 'ref': "remove", }, 'rm': { 'ref': "remove", }, 't': { 'ref': "toggle", }, 'list': { 'short': 'l', 'usage': 'list', 'help': 'list mappings', 'function': { "context": "patches_module", "f": "list" } }, 'add': { 'usage': 'add *address *hex_payload', 'help': 'write *hex_payload into *address', 'function': { "context": "patches_module", "f": "add" } }, 'remove': { 'usage': 'remove *address', 'help': 'remove active patch at *address', 'function': { "context": "patches_module", "f": "remove" } }, 'toggle': { 'usage': 'toggle *address *status (0: off / 1: on)', 'help': 'toggle patch at *address', 'function': { "context": "patches_module", "f": "toggle" } } } } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.context_name = "my_module" self.command_map = { "module_test": { 'function': { "context": "my_module", "f": "module_test", 'args': 'int hexsum intsum' }, 'help': 'HELP My_module test function', 'sub_commands': { 'sub1': { 'help': 'SUB1 HELP', 'function': { 'context': 'my_module', 'f': 'sub1' } }, 's1': { 'ref': 'sub1' } } } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.context_name = "registers_module" self.command_map = { 'r': { 'ref': "registers", }, 'reg': { 'ref': "registers", }, 'regs': { 'ref': "registers", }, 'register': { 'ref': "registers", }, 'registers': { 'short': 'r,reg,regs', 'usage': 'registers [read|write] [...]', 'help': 'print registers summary if no args given', 'function': { "context": "registers_module", "f": "registers" }, 'sub_commands': { 'w': { 'ref': "write", }, 'r': { 'ref': "read", }, 'write': { 'short': 'w', 'usage': 'registers write *register (i.e r0) *value', 'help': 'write value into registers', 'function': { "context": "registers_module", "f": "write" } }, 'read': { 'short': 'r', 'usage': 'registers read *register (i.e r0)', 'help': 'read specific register', 'function': { "context": "registers_module", "f": "read" } } } } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.mappings = [] self.context_name = "mappings_module" self.command_map = { 'map': { 'help': 'memory mappings', 'function': { "context": "mappings_module", "f": "list" } } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.context_name = "binary_loader" self.command_map = { 'lb': { 'ref': "load", }, "load": { 'short': 'lb', 'usage': 'load *file_path *offset', 'function': { "context": "binary_loader", "f": "load" }, 'help': 'load binary and map it to specific offset' } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.context_name = "module_find" self.command_map = { 'f': { 'ref': "find", }, "find": { 'short': 'f', 'usage': 'find [*map|*offset] *hex', 'function': { "context": "module_find", "f": "find" }, 'help': 'find hexa in memory map region' } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) # we can hold keystone instance here self.keystone_instance = None self.ks_arch = None self.ks_mode = None self.context_name = "asm_module" self.command_map = { 'dis': { 'ref': "disassemble", }, 'disasm': { 'ref': "disassemble", }, 'asm': { 'ref': "assemble", }, 'assemble': { 'short': 'asm', 'function': { "context": "asm_module", "f": "assemble" }, 'help': 'assemble instructions', 'usage': 'asm *instructions (\'mov r1, r3;add r0, r3\') [! (reset config)]' }, 'disassemble': { 'short': 'dis,disasm', 'usage': 'disasm *hex_payload [arch (arm)] [mode (thumb)]', 'help': 'disassemble instructions', 'function': { "context": "asm_module", "f": "disassemble" } }, }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) # init config maps self.configs_map = { 'cs_arch': '', 'cs_mode': '', 'entry_point': 0x0, 'exit_point': 0x0, 'ks_arch': '', 'ks_mode': '', 'print_instructions': 0 } self.context_name = "configs_module" self.command_map = { 'conf': { 'ref': "configs", }, 'config': { 'ref': "configs", }, 'configs': { 'help': 'print available configurations', 'function': { "context": "configs_module", "f": "configs" } }, 'set': { 'help': 'set configuration', 'usage': 'set *config_name *value', 'function': { "context": "configs_module", "f": "set" } } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.context_name = "memory_module" self.command_map = { 'm': { 'ref': "memory", }, 'memory': { 'short': 'm', 'usage': 'memory [dump|fwrite|map|read|write|unmap] [...]', 'help': 'memory operations', 'sub_commands': { 'd': { 'ref': "dump", }, 'r': { 'ref': "read", }, 'w': { 'ref': "write", }, 'fw': { 'ref': "fwrite", }, 'm': { 'ref': "map", }, 'u': { 'ref': "unmap", }, 'um': { 'ref': "unmap", }, 'umap': { 'ref': "unmap", }, 'map': { 'short': 'm', 'usage': 'map *address *length [map name]', 'help': 'map *length at *address', 'function': { "context": "memory_module", "f": "map" } }, 'unmap': { 'short': 'u,um', 'usage': 'unmap [address] [length]', 'help': 'unmap *length at *address', 'function': { "context": "memory_module", "f": "unmap" } }, 'dump': { 'short': 'd', 'usage': 'memory dump *offset *length *file_path]', 'help': 'dump memory', 'function': { "context": "memory_module", "f": "dump" } }, 'read': { 'short': 'r', 'usage': 'memory read *offset *length [format: h|i]', 'help': 'read memory', 'function': { "context": "memory_module", "f": "read" } }, 'write': { 'short': 'w', 'usage': 'memory write *offset *hex_payload', 'help': 'memory write', 'function': { "context": "memory_module", "f": "write" } }, 'fwrite': { 'short': 'fw', 'usage': 'memory fwrite *offset *file_path', 'help': 'write binary into offset', 'function': { "context": "memory_module", "f": "fwrite" } } } } }
def __init__(self, core_instance): """ create a context_name and command_map as requested from the UnicornDbgModule :param core_instance: """ AbstractUnicornDbgModule.__init__(self, core_instance) # bp map self.bp_list = [] self.context_name = "core_module" self.command_map = { 'q': { 'ref': "quit", }, 'exit': { 'ref': "quit", }, 's': { 'ref': "show", }, 'c': { 'ref': "continue", }, 'b': { 'ref': "breakpoint", }, 'bkp': { 'ref': "breakpoint", }, 'break': { 'ref': "breakpoint", }, 'd': { 'ref': "delete", }, 'h': { 'ref': "help", }, 'n': { 'ref': "next", }, 'ni': { 'ref': "next", }, 'p': { 'ref': "print", }, 'quit': { 'short': 'q', 'function': { "context": "core_module", "f": "quit" }, 'help': 'quit command' }, 'help': { 'short': 'h', 'function': { "context": "core_module", "f": "help" }, 'help': 'show command', 'usage': 'help [command]' }, 'breakpoint': { 'short': 'b,bkp,break', 'function': { "context": "core_module", "f": "breakpoint" }, 'help': 'break the emulation at specific address', 'usage': 'breakpoint *address' }, 'delete': { 'short': 'd', 'function': { "context": "core_module", "f": "rm_breakpoint" }, 'help': 'remove breakpoint', 'usage': 'delete *address' }, 'continue': { 'short': 'c', 'help': 'start / continue emulation', 'function': { "context": "core_module", "f": "continue_exec" } }, 'modules': { 'function': { "context": "core_module", "f": "modules" }, 'help': 'loaded modules list' }, 'restore': { 'function': { "context": "core_module", "f": "restore" }, 'help': 'set emulator to entry address and restore initial memory context' }, 'next': { 'short': 'n,ni', 'function': { "context": "core_module", "f": "next" }, 'help': 'next instruction' }, 'print': { 'short': 'p', 'function': { "context": "core_module", "f": "print" }, 'help': 'eval and print instruction' } }
def __init__(self, core_instance): AbstractUnicornDbgModule.__init__(self, core_instance) self.executors_map = {} self.executors_id_map = {} self.context_name = "executors_module" self.command_map = { 'e': { 'ref': "executors", }, 'ex': { 'ref': "executors", }, 'exe': { 'ref': "executors", }, 'exec': { 'ref': "executors", }, 'executor': { 'ref': "executors", }, 'executors': { 'short': 'e,ex,exec', 'help': 'manage executors', 'usage': 'exec [delete|load|new|run|save]', 'function': { "context": "executors_module", "f": "exec" }, 'sub_commands': { 'd': { 'ref': "delete", }, 'del': { 'ref': "delete", }, 'l': { 'ref': "load", }, 'ld': { 'ref': "load", }, 'r': { 'ref': "run", }, 's': { 'ref': "save", }, 'n': { 'ref': "new", }, 'delete': { 'short': 'd,del', 'usage': 'exec delete *executors_id', 'help': 'delete an executor', 'function': { "context": "executors_module", "f": "del_exec" } }, 'load': { 'short': 'l,ld', 'usage': 'exec load *file_path', 'help': 'load an executor from file (1 command per line)', 'function': { "context": "executors_module", "f": "load_exec" } }, 'run': { 'short': 'r', 'usage': 'exec run *executors_id', 'help': 'run an executor', 'function': { "context": "executors_module", "f": "run_exec" } }, 'save': { 'short': 's', 'usage': 'exec save *executors_id', 'help': 'save an executor', 'function': { "context": "executors_module", "f": "save_exec" } }, 'new': { 'short': 'n', 'usage': 'exec new', 'help': 'create an executor', 'function': { "context": "executors_module", "f": "new_exec" } } } } }