Skip to content

Commit

Permalink
Merge pull request #584 from pudding0803/lab7
Browse files Browse the repository at this point in the history
[LAB7] 312552057
  • Loading branch information
TaiYou-TW authored Jun 27, 2024
2 parents 2808414 + d4b6478 commit db56456
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lab7/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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())


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


if __name__ == '__main__':
main()

0 comments on commit db56456

Please sign in to comment.