angr.state_plugins.preconstrainer¶
- class angr.state_plugins.preconstrainer.SimStatePreconstrainer¶
Bases:
SimStatePluginThis state plugin manages the concept of preconstraining - adding constraints which you would like to remove later.
- Parameters:
constrained_addrs – SimActions for memory operations whose addresses should be constrained during crash analysis
- __init__(constrained_addrs=None)¶
- preconstrain(value, variable)¶
Add a preconstraint that
variable == valueto the state.- Parameters:
value – The concrete value. Can be a bitvector or a bytestring or an integer.
variable – The BVS to preconstrain.
- preconstrain_file(content, simfile, set_length=False)¶
Preconstrain the contents of a file.
- Parameters:
content – The content to preconstrain the file to. Can be a bytestring or a list thereof.
simfile – The actual simfile to preconstrain
- preconstrain_flag_page(magic_content)¶
Preconstrain the data in the flag page.
- Parameters:
magic_content – The content of the magic page as a bytestring.
- remove_preconstraints(to_composite_solver=True, simplify=True)¶
Remove the preconstraints from the state.
If you are using the zen plugin, this will also use that to filter the constraints.
- Parameters:
to_composite_solver – Whether to convert the replacement solver to a composite solver. You probably want this if you’re switching from tracing to symbolic analysis.
simplify – Whether to simplify the resulting set of constraints.
- reconstrain()¶
Split the solver. If any of the subsolvers time out after a short timeout (10 seconds), re-add the preconstraints associated with each of its variables. Hopefully these constraints still allow us to do meaningful things to the state.