angr.analyses.vfg¶
- class angr.analyses.vfg.VFGJob¶
Bases:
CFGJobBaseA job descriptor that contains local variables used during VFG analysis.
- __init__(*args, **kwargs)¶
- Return type:
None
- callstack_repr(kb)¶
- Parameters:
kb (KnowledgeBase)
- class angr.analyses.vfg.PendingJob¶
Bases:
objectDescribes a pending job during VFG analysis.
- __init__(block_id, state, call_stack, src_block_id, src_stmt_idx, src_ins_addr)¶
- block_id
- state
- call_stack
- src_block_id
- src_stmt_idx
- src_ins_addr
- class angr.analyses.vfg.AnalysisTask¶
Bases:
objectAn analysis task describes a task that should be done before popping this task out of the task stack and discard it.
- __init__()¶
- Return type:
None
- property done¶
- class angr.analyses.vfg.FunctionAnalysis¶
Bases:
AnalysisTaskAnalyze a function, generate fix-point states from all endpoints of that function, and then merge them to one state.
- __init__(function_address, return_address)¶
- call_analysis: AnalysisTask | None
- class angr.analyses.vfg.CallAnalysis¶
Bases:
AnalysisTaskAnalyze a call by analyze all functions this call might be calling, collect all final states generated by analyzing those functions, and merge them into one state.
- __init__(address, return_address, function_analysis_tasks=None, mergeable_plugins=None)¶
- register_function_analysis(task)¶
- Return type:
- Parameters:
task (FunctionAnalysis)
- class angr.analyses.vfg.VFGNode¶
Bases:
objectA descriptor of nodes in a Value-Flow Graph
- __init__(addr, key, state=None)¶
Constructor.
- narrowing_times: int
- events: list
- input_variables: list
- actions: list
- append_state(s, is_widened_state=False)¶
Appended a new state to this VFGNode. :type s: :param s: The new state to append :type is_widened_state: :param is_widened_state: Whether it is a widened state or not.
- class angr.analyses.vfg.VFG¶
Bases:
ForwardAnalysis[SimState,VFGNode,VFGJob,BlockID,SimState],AnalysisThis class represents a control-flow graph with static analysis result.
Perform abstract interpretation analysis starting from the given function address. The output is an invariant at the beginning (or the end) of each basic block.
Steps:
Generate a CFG first if CFG is not provided.
Identify all merge points (denote the set of merge points as Pw) in the CFG.
Cut those loop back edges (can be derived from Pw) so that we gain an acyclic CFG.
- Identify all variables that are 1) from memory loading 2) from initial values, or 3) phi functions. Denote
the set of those variables as S_{var}.
- Start real AI analysis and try to compute a fix point of each merge point. Perform widening/narrowing only on
variables in S_{var}.
- __init__(cfg=None, context_sensitivity_level=2, start=None, function_start=None, interfunction_level=0, initial_state=None, avoid_runs=None, remove_options=None, timeout=None, max_iterations_before_widening=8, max_iterations=40, widening_interval=3, final_state_callback=None, status_callback=None, record_function_final_states=False)¶
- Parameters:
cfg (
CFGEmulated|None) – The control-flow graph to base this analysis on. If none is provided, we will construct a CFGEmulated.context_sensitivity_level (
int) – The level of context-sensitivity of this VFG. It ranges from 0 to infinity. Default 2.function_start (
int|None) – The address of the function to analyze.interfunction_level (
int) – The level of interfunction-ness to beinitial_state (
SimState|None) – A state to use as the initial oneremove_options (
set[str] |None) – State options to remove from the initial state. It only works when initial_state is Nonefinal_state_callback (
Callable[[SimState,CallStack],Any] |None) – callback function when countering final statestatus_callback (
Callable[[VFG],Any] |None) – callback function used in _analysis_core_baremetalstart (int | None)
max_iterations_before_widening (int)
max_iterations (int)
widening_interval (int)
record_function_final_states (bool)
- Return type:
None
- property function_initial_states¶
- property function_final_states¶
- get_any_node(addr)¶
Get any VFG node corresponding to the basic block at @addr. Note that depending on the context sensitivity level, there might be multiple nodes corresponding to different contexts. This function will return the first one it encounters, which might not be what you want.
- irsb_from_node(node)¶
- copy()¶