Example #1
0
def init_execut_apis(fp_trace):
    "get apis in execution path"
    global EXECUT_APIS
    if CUCKOO:
        if CUCKOO_ORG:
            api_calls = load_cuckoo_tracefile(fp_trace)
        else:
            api_calls = load_cuckoo_apicalls(fp_trace)
    elif ZEROWINE:
        api_calls = load_zerowine_tracefile(fp_trace)
    apis_exe = set()
    for api in api_calls:
        apis_exe.add(filter_api(api))
    EXECUT_APIS = apis_exe
def main(fp_fcg, fp_trace):
    global DEBUG
    paths_fcg = convert(fp_fcg)
    if CUCKOO:
        api_calls = load_cuckoo_tracefile(fp_trace)
    elif ZEROWINE:
        api_calls = load_zerowine_tracefile(fp_trace)
    paths_exe = prepare_execution_paths(api_calls)

    print ("[x]path metrics for static fcg:")
    static_met = compute_paths_metrics(paths_fcg)
    draw_path(paths_fcg)
    sys.exit(0)

    print ("[x]path metrics for execution:")
    DEBUG = True
    exe_met = compute_paths_metrics(paths_exe)
    prog_num = exe_met[0]*1.0/static_met[0]
    prog_len = exe_met[1]*1.0/static_met[1]
    print ("execution path number ratio: {0}".format(prog))
    print ("execution path length ratio: {0}".format(prog))