def Create(self): ea = ScreenEA() if not idaapi.simplecustviewer_t.Create(self, '%s - Nao' % (idc.GetFunctionName(ea))): return False self.instruction_list = idautils.GetInstructionList() self.instruction_list.extend(['ret']) self.register_list = idautils.GetRegisterList() self.register_list.extend(['r8l', 'r9l', 'r10l', 'r11l', 'r12l', 'r13l', 'r14l', 'r15l', 'r8w', 'r9w', 'r10w', 'r11w', 'r12w', 'r13w', 'r14w', 'r15w', 'r8d', 'r9d', 'r10d', 'r11d', 'r12d', 'r13d', 'r14d', 'r15d', 'eax', 'ebx', 'ecx', 'edx', 'edi', 'esi', 'ebp', 'esp', 'rax', 'rbx', 'rcx', 'rdx', 'rdi', 'rsi', 'rbp', 'rsp']) f = idaapi.get_func(ea) self.fc = idaapi.FlowChart(f) self.block_list = [] for block in self.fc: self.block_list.append(format(block.startEA, 'x').upper()) self.load(ea) action_desc = idaapi.action_desc_t( 'nao:jump', # The action name. 'Jump', # The action text. JumpHandler(self), # The action handler. '', # Optional: the action shortcut '', # Optional: the action tooltip (available in menus/toolbar) ) # Optional: the action icon (shows when in menus/toolbars) use numbers 1-255 idaapi.register_action(action_desc) idaapi.attach_action_to_popup(self.GetWidget(), None, 'nao:jump', None) return True
def data(self): instruction_hist = defaultdict(int) instruction_hist['instruction_set'] = idautils.GetInstructionList() for offset in idautils.FuncItems(self.offset): mnem_line = idc.GetMnem(offset) mnem_line = mnem_line.lower() instruction_hist[mnem_line] += 1 instruction_hist = { mnem: value for mnem, value in instruction_hist.items() } return instruction_hist
def Create(self, fn): # Create the customview if not ida_kernwin.simplecustviewer_t.Create( self, "Viewing file - %s" % os.path.basename(fn)): return False self.instruction_list = idautils.GetInstructionList() self.instruction_list.extend(["ret"]) self.register_list = idautils.GetRegisterList() self.register_list.extend(["eax", "ebx", "ecx", "edx", "edi", "esi", "ebp", "esp"]) self.fn = fn if not self.reload_file(): return False return True
def Create(self, fn): # Create the customview if not idaapi.simplecustviewer_t.Create(self, "Viewing file - %s" % os.path.basename(fn)): return False self.instruction_list = idautils.GetInstructionList() self.instruction_list.extend(["ret"]) self.register_list = idautils.GetRegisterList() self.register_list.extend(["eax", "ebx", "ecx", "edx", "edi", "esi", "ebp", "esp"]) self.fn = fn if not self.reload_file(): return False self.id_refresh = self.AddPopupMenu("Refresh") self.id_close = self.AddPopupMenu("Close") return True
def Create(self): ea = ScreenEA() if not idaapi.simplecustviewer_t.Create( self, '%s - nao' % (idc.GetFunctionName(ScreenEA()))): return False self.instruction_list = idautils.GetInstructionList() self.instruction_list.extend(['ret']) self.register_list = idautils.GetRegisterList() self.register_list.extend( ['eax', 'ebx', 'ecx', 'edx', 'edi', 'esi', 'ebp', 'esp']) f = idaapi.get_func(ScreenEA()) self.fc = idaapi.FlowChart(f) self.block_list = [] for block in self.fc: self.block_list.append(format(block.startEA, 'x').upper()) self.load(ea) self.id_jmp = self.AddPopupMenu('Jump') return True