Esempio n. 1
0
def test_uninitialized_reads(arch, starts):
    uninitialized_reads = projects['uninitialized_reads']
    cfg = uninitialized_reads[arch].analyses.CFG()
    for start in starts:
        uninitialized_reads[arch].analyses.VFG(start=start)
    vfg = uninitialized_reads[arch].vfg
    variable_seekr = angr.VariableSeekr(uninitialized_reads[arch], cfg, vfg)

    for start in starts:
        try:
            variable_seekr.construct(func_start=start)
        except AngrError:
            l.info('AngrError...')
            continue
        function_manager = cfg.function_manager
        for func_addr, _ in function_manager.functions.items():
            l.info("Function %xh", func_addr)
            variable_manager = variable_seekr.get_variable_manager(func_addr)
            if variable_manager is None:
                continue
            # TODO: Check the result returned
            l.info("Variables: ")
            for var in variable_manager.variables:
                if isinstance(var, angr.StackVariable):
                    l.info(var.detail_str())
                else:
                    l.info("%s(%d),  referenced at %08x", var, var._size, var._inst_addr)

    import ipdb; ipdb.set_trace()
Esempio n. 2
0
def test_cfg_1(arch, start):
    cfg_1 = projects['cfg_1']
    cfg = cfg_1[arch].analyses.CFG()
    vfg = cfg_1[arch].analyses.VFG(start=start)
    variable_seekr = angr.VariableSeekr(cfg_1[arch], cfg, vfg)
    variable_seekr.construct(func_start=start)
    function_manager = cfg.function_manager
    for func_addr, _ in function_manager.functions.items():
        l.info("Function %08xh", func_addr)
        variable_manager = variable_seekr.get_variable_manager(func_addr)
        if variable_manager is None:
            continue
        # TODO: Check the result returned
        l.info("Variables: ")
        for var in variable_manager.variables:
            if isinstance(var, angr.StackVariable):
                l.info(var.detail_str())
            else:
                l.info("%s(%d),  referenced at %08x", var, var._size, var._inst_addr)