cozy.stubs¶
Attributes¶
Classes¶
A Stubber outputs Python source code that represents stubs for the callees of a given binary function. |
Module Contents¶
- class cozy.stubs.Stubber(binary_path: str)¶
A Stubber outputs Python source code that represents stubs for the callees of a given binary function.
If foo is the function to be analyzed, and foo calls a two-argument function bar, then the following stub will be among those generated for foo:
- class bar(angr.SimProcedure):
- def run(self, arg0, arg1):
pass
The stub can then be filled out and used during symbolic execution.
- Parameters:
binary_path (str) – Path for the binary under analysis.
- Variables:
cfg (angr.analyses.cfg.cfg_fast.CFGFast) – CFG for the binary.
cg (networkx.classes.multidigraph.MultiDiGraph) – Call graph for the binary.
- cfg¶
- cg¶
- extract_func(func_name: str) angr.knowledge_plugins.functions.function.Function ¶
Returns the function with the given name from the CFG.
- Parameters:
func_name (str) – Name of the function to extract.
- Returns:
Function with the given name.
- Return type:
angr.knowledge_plugins.functions.function.Function
- get_callees(func_name: str) list[angr.knowledge_plugins.functions.function.Function] ¶
Returns the list of functions called by function func_name.
- Parameters:
func_name (str) – Name of the caller function.
- Returns:
The list of functions called by func_name.
- Return type:
list[angr.knowledge_plugins.functions.function.Function]
- make_stub(func: angr.knowledge_plugins.functions.function.Function) str ¶
Returns an empty Python class definition (in string form) named after func that inherits from angr.SimProcedure.
- Parameters:
func (angr.knowledge_plugins.functions.function.Function) – Function to be stubbed.
- Returns:
Empty Python class definition representing a symbolic execution stub for function func.
- Return type:
str
- make_callee_stubs(func_name: str) list[str] ¶
Returns a list of stubs for the callees of function func_name.
- Parameters:
func_name (str) – Name of the caller function.
- Returns:
Stubs for the callees of function func_name.
- Return type:
list[str]
- cozy.stubs.unstripped_binary_path = '../test_programs/GridIDPS/build/amp_challenge_arm.ino_unstripped.elf'¶