Skip to content

Commit

Permalink
feat: complete basic version of sol.py (objective of lab7)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimmyHuangPeko committed May 7, 2024
1 parent ac8ccd3 commit c2b7262
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lab7/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import angr, sys

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())

project = angr.Project('./login')
init_state = project.factory.entry_state()
simulation = project.factory.simgr(init_state)
simulation.explore(find=success_condition, avoid=fail_condition)
solution = simulation.found[0]
print(solution.posix.dumps(sys.stdin.fileno()))

0 comments on commit c2b7262

Please sign in to comment.