我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用idaapi.get_root_filename()。
def _normalize_coverage(self, coverage_data, metadata): """ Normalize loaded DrCov data to the database metadata. """ # extract the coverage relevant to this IDB (well, the root binary) root_filename = idaapi.get_root_filename() coverage_blocks = coverage_data.get_blocks_by_module(root_filename) # rebase the basic blocks base = idaapi.get_imagebase() rebased_blocks = rebase_blocks(base, coverage_blocks) # coalesce the blocks into larger contiguous blobs condensed_blocks = coalesce_blocks(rebased_blocks) # flatten the blobs into individual instructions or addresses return metadata.flatten_blocks(condensed_blocks)
def main(function, f_image, f_all, f_overwrite): sys.setrecursionlimit(3000) program = idaapi.get_root_filename() start_time = time.time() cfgs = get_cfgs() dump_function_info(cfgs, program, function, f_image, f_all, f_overwrite) result_time = time.time() - start_time print "Dump finished." print "result_time: " + str(result_time) + " sec."
def filename(): '''Returns the filename that the database was built from.''' return idaapi.get_root_filename()
def GetInputFile(): """ Get input file name This function returns name of the file being disassembled """ return idaapi.get_root_filename()
def do_export(): db = {} module = idaapi.get_root_filename().lower() base = idaapi.get_imagebase() file = AskFile(1, "x64dbg database|%s" % get_file_mask(), "Export database") if not file: return print "Exporting database %s" % file db["labels"] = [{ "text": name, "manual": False, "module": module, "address": "0x%X" % (ea - base) } for (ea, name) in Names()] print "%d label(s) exported" % len(db["labels"]) db["comments"] = [{ "text": comment.replace("{", "{{").replace("}", "}}"), "manual": False, "module": module, "address": "0x%X" % (ea - base) } for (ea, comment) in Comments()] print "%d comment(s) exported" % len(db["comments"]) db["breakpoints"] = [{ "address": "0x%X" % (ea - base), "enabled": True, "type": bptype, "titantype": "0x%X" % titantype, "oldbytes": "0x%X" % oldbytes, "module": module, } for (ea, bptype, titantype, oldbytes) in Breakpoints()] print "%d breakpoint(s) exported" % len(db["breakpoints"]) with open(file, "w") as outfile: json.dump(db, outfile, indent=1) print "Exported database. Done!" # 1) Create the handler class