angr

9.2.209 · active · verified Sun Apr 12

angr is a multi-architecture binary analysis toolkit, providing capabilities for dynamic symbolic execution, various static analyses, and program instrumentation on binaries. It is actively developed and maintained, with frequent minor and patch releases, and less frequent major version changes.

Warnings

Install

Imports

Quickstart

This quickstart loads a specified binary (defaults to '/bin/ls') into an angr Project, prints basic information, and creates an initial execution state. It demonstrates the fundamental steps for starting an analysis. The commented-out section shows a typical pattern for symbolic execution, which would require a specific challenge binary with known target addresses.

import angr
import os

binary_path = os.environ.get('ANGR_BINARY_PATH', '/bin/ls')

try:
    project = angr.Project(binary_path, auto_load_libs=False)
    print(f"Successfully loaded binary: {project.filename}")
    print(f"Architecture: {project.arch}")
    print(f"Entry point: {hex(project.entry)}")

    # Example of creating an initial state
    initial_state = project.factory.entry_state()
    print(f"Initial state created at: {hex(initial_state.addr)}")

    # Optional: Basic symbolic execution (requires a suitable binary and goal)
    # simgr = project.factory.simulation_manager(initial_state)
    # simgr.explore(find=0x400844, avoid=0x400850) # Replace with addresses relevant to your binary
    # if simgr.found:
    #     solution = simgr.found[0]
    #     print(f"Found solution input: {solution.posix.dumps(0)}")

except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure 'ANGR_BINARY_PATH' is set to a valid executable, or that /bin/ls exists.")

view raw JSON →