# Sometimes, you want to specify where the program should start. The variable# start_address will specify where the symbolic execution engine should begin.# Note that we are using blank_state, not entry_state.# (!)
start_address =0x080488B1# :integer (probably hexadecimal)
initial_state = project.factory.blank_state(addr=start_address)
(1)符号化寄存器
# angr没有办法处理scanf这种输入# Create a symbolic bitvector
password_size_in_bits =32# :integer
password0 = claripy.BVS('password0', password_size_in_bits)# Set a register to a symbolic value.
initial_state.regs.eax = password0
# Solve for the symbolic values. If there are multiple solutions, we only# care about one, so we can use eval, which returns any (but only one)# solution. Pass eval the bitvector you want to solve for.
solution0 = solution_state.solver.eval(password0)# Add the constraint to the state to instruct z3 to include it when solving# for input.
solution_state.add_constraints(constrained_parameter_bitvector == constrained_parameter_desired_value)