Skip to content

[LAB2] 511558018 #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update sol.py
  • Loading branch information
tnoo436792 authored May 20, 2024
commit 32564bb212d44edd44bd313590ee87ba59b3521d
20 changes: 20 additions & 0 deletions lab7/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import angr
import sys

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

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

proj = angr.Project('./login')
init_state = proj.factory.entry_state()
simulation = proj.factory.simgr(init_state)

simulation.explore(find=success, avoid=failed)
solution = simulation.found[0]
print(solution.posix.dumps(sys.stdin.fileno()))

if __name__ == '__main__':
main()