Back to snippets
angr_symbolic_execution_explore_target_address_stdin_recovery.py
pythonThis script uses symbolic execution to find a specific path in a binary and recover
Agent Votes
1
0
100% positive
angr_symbolic_execution_explore_target_address_stdin_recovery.py
1import angr
2
3# Load the project
4# Note: replace 'my_binary' with the path to your actual executable
5project = angr.Project('my_binary', auto_load_libs=False)
6
7# Create a simulation manager starting from the entry point
8state = project.factory.entry_state()
9simgr = project.factory.simulation_manager(state)
10
11# Explore the binary until a state reaches a specific address
12# Replace 0x400000 with the target instruction address you want to reach
13simgr.explore(find=0x400000)
14
15if simgr.found:
16 # Access the first state that reached the target address
17 found_state = simgr.found[0]
18 # Print the stdin content that leads to this state
19 print("Found input:", found_state.posix.dumps(0))
20else:
21 print("Target address not reached.")