예제 #1
0
def get_bugs_from_functions(arg_funcs, ld_path):

    for func in arg_funcs:
        if use_ghidra:
            args = gh.get_func_args(func)
        else:
            args = fh.get_func_args(func)

        ld_path = "/home/chris/Tools/firmware_slap/Almond_Root/lib"
        async_task = async_trace_func.apply_async(
            args=[
                func['offset'], args, func['file_path'], ld_path, func['name']
            ],
            time_limit=120,
            worker_max_memory_per_child=2048000)
        func['task'] = async_task
        func['posted_results'] = False

    bar = tqdm.tqdm(total=len(arg_funcs),
                    desc="[~] Finding all the vulnerabilities")
    while not all([x['task'].ready() for x in arg_funcs]):
        done_count = len(
            [x['task'].ready() for x in arg_funcs if x['task'].ready()])
        check_bugs(arg_funcs)
        bar.update(done_count - bar.n)
        time.sleep(1)
    bar.close()
    arg_funcs = check_bugs(arg_funcs)

    #bugs_dict = [x.get(propagate=False) for x in async_group if not x.failed()]
    return arg_funcs
예제 #2
0
def get_bugs_from_functions(arg_funcs, ld_path):

    for func in arg_funcs:
        if use_ghidra:
            args = gh.get_func_args(func)
        else:
            args = fh.get_func_args(func)

        async_task = async_trace_func.apply_async(
            args=[
                func['offset'], args, func['file_path'], ld_path, func['name']
            ],
            time_limit=function_timeout,
            worker_max_memory_per_child=function_memory_limit)
        func['task'] = async_task
        func['posted_results'] = False

    bar = tqdm.tqdm(total=len(arg_funcs),
                    desc="[~] Finding all the vulnerabilities")
    while not all([x['task'].ready() for x in arg_funcs]):
        done_count = len(
            [x['task'].ready() for x in arg_funcs if x['task'].ready()])
        check_bugs(arg_funcs)
        bar.update(done_count - bar.n)
        time.sleep(1)
    bar.close()
    arg_funcs = check_bugs(arg_funcs)

    return arg_funcs