def load_file(li, neflags, format): """ Load the file into database @param li: a file-like object which can be used to access the input data @param neflags: options selected by the user, see loader.hpp @return: 0-failure, 1-ok """ global event, element if ida_idp.get_idp_name() == None: ida_idp.set_processor_type("metapc", ida_idp.SETPROC_LOADER) status = 0 st = idc.set_ida_state(idc.IDA_STATUS_WORK) xml = idaxml.XmlImporter(idaxml.LOADER, 0) try: status = xml.import_xml() except idaxml.Cancelled: msg = "XML PROGRAM import cancelled!" print "\n" + msg idc.warning(msg) except idaxml.MultipleAddressSpacesNotSupported: msg = "XML Import cancelled!" msg += "\n\nXML Import does not currently support" msg += "\nimporting multiple address spaces." print "\n" + msg idc.warning(msg) except: print "\nHouston, we have a problem!" msg = "***** Exception occurred: XML loader failed! *****" print "\n" + msg + "\n", sys.exc_type, sys.exc_value print event, element.tag, element.attrib idc.warning(msg) finally: idc.set_ida_state(st) xml.cleanup() return status
result_exe_id, result_address, filename, functionname, odds)) if print_separator: print("--------------------------------------") def match_all_functions(): search_index sim_hasher for function in Functions(MinEA(), MaxEA()): load_function(function_address=function) import ida_idp processor_to_call_instructions = {"arm": "FOO", "pc": "call"} call_instruction_string = processor_to_call_instructions[ ida_idp.get_idp_name()] hotkey_mappings = { "Shift-S", save_function, "Shift-L", load_function, "Shift-A", save_all_functions, "Shift-H", print_hash, } hotkey_contexts = [] try:
functionname = functionname.replace('\r', '') print("%lx:%lx %lx-%lx Result is %f - %lx:%lx %s '%s' (1 in %f searches)" % (executable_id, address, hashes[0], hashes[1], same_bits, result_exe_id, result_address, filename, functionname, odds)) if print_separator: print("--------------------------------------") def match_all_functions(): search_index sim_hasher for function in Functions(MinEA(), MaxEA()): load_function(function_address=function) import ida_idp processor_to_call_instructions = { "arm" : "FOO", "pc" : "call" } call_instruction_string = processor_to_call_instructions[ida_idp.get_idp_name()] hotkey_mappings = { "Shift-S", save_function, "Shift-L", load_function, "Shift-A", save_all_functions, "Shift-H", print_hash, } hotkey_contexts = [] try: hotkey_context_S if idaapi.del_hotkey(hotkey_context_S): print("FunctionSimSearch: Hotkey S unregistered.")