Project class is the main entry point for the angr binary analysis framework. It contains a set of binaries and their relationships, and provides access to analyses, symbolic execution, and program manipulation capabilities.
Class Signature
Parameters
The path to the main executable object to analyze, or a CLE Loader object, or a file-like object.
The mode of analysis to use by default. Defaults to ‘symbolic’.
A list of function names that, when imported from shared libraries, should never be stepped into in analysis (calls will return an unconstrained value).
Whether to replace resolved dependencies for which simprocedures are available with said simprocedures.
A function that, when passed a function name, returns whether or not to wrap it with a simprocedure.
A list of functions to not wrap with simprocedures.
The target architecture (auto-detected otherwise).
A SimOS class or name to use for this project.
The SimEngine class to use for this project.
If True, cache translated basic blocks rather than re-translating them.
Whether to aggressively support self-modifying code. When enabled, emulation will try to read code from the current state instead of the original memory.
The plugin preset for the analyses provider (i.e. Analyses instance).
Attributes
The architecture of the binary.
The available analyses for this project.
The program entrypoint address.
Provides access to important analysis elements such as simulation managers, states, and blocks.
The filename of the executable.
The CLE program loader containing all loaded objects.
The project’s knowledge base, containing recovered information about the program.
Dictionary of things that should be loaded/stored with the Project.
The LLM client for this project (lazy-initialized from environment variables).
Methods
Hooking Methods
hook()
hook()
Signature:Hook a section of code with a custom function. This is used internally to provide symbolic summaries of library functions, and can be used to instrument execution or to modify control flow.When hook is not specified, it returns a function decorator that allows easy hooking.Usage:Parameters:
The address to hook.
A SimProcedure instance or a function to run at the given address.
The number of bytes that will be skipped by executing the hook.
Keyword arguments passed to the procedure’s
run method.Control behavior when address is already hooked. True: silently replace. False: warn and don’t replace. None: warn and replace.
is_hooked()
is_hooked()
Signature:Returns True if Returns:
addr is hooked.Parameters:An address to check.
bool - True if addr is hooked, False otherwise.hooked_by()
hooked_by()
Signature:Returns the current hook for Returns:
addr.Parameters:An address.
SimProcedure | None - The hook at that address, or None if not hooked.unhook()
unhook()
hook_symbol()
hook_symbol()
Signature:Resolve a dependency in a binary by symbol name and hook that address.Parameters:Returns:
The name of the symbol to hook, or an address.
The SimProcedure instance to hook with.
Keyword arguments for the SimProcedure.
Whether to replace existing hooks.
int - The address of the hooked symbol.is_symbol_hooked()
is_symbol_hooked()
Signature:Check if a symbol is already hooked.Parameters:Returns:
Name of the symbol.
bool - True if the symbol is hooked, False otherwise.unhook_symbol()
unhook_symbol()
Signature:Remove the hook on a symbol.Parameters:Returns:
Name of the symbol to unhook.
bool - True if successful, False otherwise.Execution Methods
execute()
execute()
Signature:A symbolic execution helper in the simple style. Begins symbolic execution and returns when finished or terminated.This function can be run in three ways:
- With no parameters: begins execution from the entrypoint
- With a “state” parameter: begins execution from that state
- With arbitrary kwargs: passed to
project.factory.full_init_state
SimulationManager - The resulting simulation manager.terminate_execution()
terminate_execution()
Signature:Terminates a symbolic execution that was started with
Project.execute().Cache Limit Methods
get_function_cache_limit()
get_function_cache_limit()
Signature:Get the cache limit for function-level caches.Returns:
int | None - The cache limit, or None for disabling the cache.get_cfg_node_cache_limit()
get_cfg_node_cache_limit()
Signature:Get the cache limit for CFG node caches.Returns:
int | None - The cache limit, or None to disable the cache.get_cfg_edge_cache_limit()
get_cfg_edge_cache_limit()
Signature:Get the cache limit for CFG edge caches.Returns:
int | None - The cache limit, or None to disable the cache.Knowledge Base Methods
get_kb()
get_kb()
Signature:Get or create a named knowledge base.Parameters:Returns:
The name of the knowledge base.
KnowledgeBase - The requested knowledge base.Helper Function
load_shellcode()
load_shellcode()
Signature:Load a new project based on a snippet of assembly or bytecode.Parameters:Returns:
The data to load, as either a bytestring of instructions or a string of assembly text.
The name of the arch to use, or an archinfo class.
The offset into the data to start analysis.
The address to place the data in memory.
Whether this is ARM Thumb shellcode.
Project - A new Project instance.