Skip to content

Commit 9f15c1c

Browse files
authored
Merge pull request #515 from Yyrff/lab7
[LAB7] 511558014
2 parents 7423d27 + 53d7d7b commit 9f15c1c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lab7/sol.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import angr
2+
import sys
3+
4+
def is_login_successful(state):
5+
output = state.posix.dumps(sys.stdout.fileno())
6+
return b"Login successful" in output
7+
8+
def is_login_failed(state):
9+
output = state.posix.dumps(sys.stdout.fileno())
10+
return b"Login failed" in output
11+
12+
13+
proj = angr.Project('./login')
14+
initial_state = proj.factory.entry_state()
15+
sim_manager = proj.factory.simgr(initial_state)
16+
17+
18+
sim_manager.explore(find=is_login_successful, avoid=is_login_failed)
19+
20+
21+
solution = sim_manager.found[0]
22+
print(solution.posix.dumps(sys.stdin.fileno()))

0 commit comments

Comments
 (0)