Skip to content
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

[LAB7] 312551011 #577

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
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
26 changes: 26 additions & 0 deletions lab7/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import angr, sys

proj = angr.Project('./login', load_options={'auto_load_libs': False})

init_state = proj.factory.entry_state()
simgr = proj.factory.simulation_manager(init_state)

def success(state):
try:
return b"Login successful" in state.posix.dumps(1)
except:
return False

def failure(state):
try:
return b"Login failed" in state.posix.dumps(1)
except:
return False

simgr.explore(find=success, avoid=failure)

if len(simgr.found) > 0:
found = simgr.found[0]
print(found.posix.dumps(0))
else:
print("Not found")
Loading