Skip to content

Commit c24a9ac

Browse files
authored
Merge pull request #510 from KentYang123/lab7
[LAB7] 512558014
2 parents 2545bad + ec4087d commit c24a9ac

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lab7/sol.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import angr, sys
2+
3+
def success_condition(state):
4+
return b"Login successful" in state.posix.dumps(sys.stdout.fileno())
5+
def fail_condition(state):
6+
return b"Login failed" in state.posix.dumps(sys.stdout.fileno())
7+
8+
proj = angr.Project('./login')
9+
init_state = proj.factory.entry_state()
10+
simulation = proj.factory.simgr(init_state)
11+
simulation.explore(find = success_condition, avoid = fail_condition)
12+
13+
solution = simulation.found[0]
14+
print(solution.posix.dumps(sys.stdin.fileno()))

0 commit comments

Comments
 (0)