diff --git a/basicutils_7x.py b/basicutils_7x.py index 9defe27..c66574f 100644 --- a/basicutils_7x.py +++ b/basicutils_7x.py @@ -18,6 +18,7 @@ # basicutils - a version-agnostic API for IDA Pro with some (slightly) higher level functionality # This is the 7.x version - see basicutils_6x for the 7.x version +import os import ida_bytes import ida_funcs @@ -49,6 +50,12 @@ def GetFunctionName(x): def GetInputFile(): return idc.get_root_filename() +def GetIdbFile(): + return idc.get_idb_path() + +def GetRootName(): + return os.path.join(os.path.dirname(GetIdbFile()), os.path.basename(GetInputFile())) + def NextFunction(x): return idc.get_next_func(x) diff --git a/cc_base.py b/cc_base.py index 091ac44..a88a36d 100644 --- a/cc_base.py +++ b/cc_base.py @@ -18,6 +18,7 @@ import basicutils_7x as basicutils import json +import os ## Utilities @@ -71,7 +72,7 @@ def gen_mod_graph(module_list, suffix): f = basicutils.NextFunction(f) c+=1 - root_name = basicutils.GetInputFile() + root_name = basicutils.GetRootName() file = open(root_name + "_" + suffix + "_mod_graph.gv", "wb") file.write("digraph g {\n") @@ -91,7 +92,7 @@ def gen_mod_graph(module_list, suffix): def gen_rename_script(module_list, suffix): c=0 - root_name = basicutils.GetInputFile() + root_name = basicutils.GetRootName() file = open(root_name + "_" + suffix + "_labels.py", "wb") #if (IDA_VERSION < 7): @@ -117,7 +118,7 @@ def gen_rename_script(module_list, suffix): def gen_map_file(module_list, suffix): c=0 - root_name = basicutils.GetInputFile() + root_name = basicutils.GetRootName() file = open(root_name + "_" + suffix + "_map.map", "wb") while (c.csv - which can be opened in your favorite spreadsheet program def print_results(function_list, module_list1, module_list2): c=0 - root_name = basicutils.GetInputFile() + root_name = basicutils.GetRootName() file = open(root_name + "_cc_results.csv", "wb") #write header