Skip to content

Commit

Permalink
Update sol.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patty5531998 authored May 8, 2024
1 parent 89cf768 commit 5ae4ea4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lab7/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import angr, sys

proj = angr.Project("./login")

init_state = proj.factory.entry_state()
simulation = proj.factory.simgr(init_state)
simulation.explore(find=success_condition, avoid=fail_condition)

def success_condition(state):
return b"Login successful" in state.posix.dumps(sys.stdout.fileno())

def fail_condition(state):
return b"Login failed" in state.posix.dumps(sys.stdout.fileno())

solution = simulation.found[0]
print(solution.posix.dumps(sys.stdin.fileno()))

0 comments on commit 5ae4ea4

Please sign in to comment.