Example #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)

        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
def get_bugs_from_functions(arg_funcs, ld_path):

    for func in arg_funcs:
        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=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
def trace_function(func, proc_queue, ld_path=""):
    start_addr = func['offset']
    file_name = func['file_name']
    args = fh.get_func_args(func)

    proc_queue.put(
        do_trace(start_addr, args, file_name=file_name, ld_path=ld_path)[1])