2016-09-15 09:49:45 +08:00
|
|
|
from func import *
|
|
|
|
from raw_graphs import *
|
|
|
|
from idc import *
|
|
|
|
import os
|
|
|
|
import argparse
|
|
|
|
|
2023-12-02 21:53:57 +08:00
|
|
|
|
2016-09-15 09:49:45 +08:00
|
|
|
def parse_command():
|
2023-12-02 21:53:57 +08:00
|
|
|
parser = argparse.ArgumentParser(description='Process some integers.')
|
|
|
|
parser.add_argument("--path", type=str, help="The directory where to store the generated .ida file")
|
|
|
|
args = parser.parse_args()
|
|
|
|
return args
|
2016-09-15 09:49:45 +08:00
|
|
|
|
|
|
|
|
2023-12-02 21:53:57 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
args = parse_command()
|
|
|
|
path = idc.ARGV[2]
|
|
|
|
analysis_flags = idc.GetShortPrm(idc.INF_START_AF)
|
|
|
|
analysis_flags &= ~idc.AF_IMMOFF
|
|
|
|
# turn off "automatically make offset" heuristic
|
|
|
|
idc.SetShortPrm(idc.INF_START_AF, analysis_flags)
|
|
|
|
idaapi.autoWait()
|
|
|
|
cfgs = get_func_cfgs_c(FirstSeg())
|
|
|
|
binary_name = idc.GetInputFile() + '.ida'
|
|
|
|
fullpath = os.path.join(path, binary_name)
|
|
|
|
pickle.dump(cfgs, open(fullpath, 'w'))
|
|
|
|
idc.Exit(0)
|