def import_hardware_regs(overwrite_names, Path, import_segments): segements = ParseHardwareregisterFile.get_segments(Path) register = ParseHardwareregisterFile.get_register(Path) if import_segments: for seg in segements: IDAtools.create_segement(seg, 0) for regs in register: IDAtools.create_object(regs, overwrite_names, 0)
def import_file(gui_Object, filePath, import_functions, import_objects, import_sections, overwrite_names, offset): progressCounter = 0 if filePath.endswith(".elf"): #elf file elfReader = Elfloader(filePath) if import_sections: for sections in elfReader.get_all_sections(): IDAtools.create_segement(sections, offset) listSymbols = elfReader.get_all_symbols() for symbol in listSymbols: gui_Object.set_progress( int(progressCounter / len(listSymbols) * 100)) progressCounter = progressCounter + 1 Controller.create_function_data(symbol, overwrite_names, offset, 'FUNC', 'OBJECT', import_functions, import_objects) else: #Polypyus csv export fileLines = open(filePath, 'r').readlines() fileLines = [x.strip() for x in fileLines] for i in fileLines: gui_Object.set_progress( int(progressCounter / len(fileLines) * 100)) progressCounter = progressCounter + 1 line = i.split(" ") line = list(filter(None, line)) try: symbol = { 'name': line[0], 'addr': str(int(line[1], 16)), 'size': line[2], 'type': line[4] } except (IndexError, ValueError): continue Controller.create_function_data(symbol, overwrite_names, offset, 'FUNC', 'OBJECT', import_functions, import_objects)