Skip to content

Commit a979046

Browse files
committed
6/5
1 parent 125dc06 commit a979046

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lab7/sol.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import angr, sys
2+
3+
def successful(state):
4+
return b"Login successful" in state.posix.dumps(sys.stdout.fuleno())
5+
6+
def fail(state):
7+
return b"Login fauled" in state.posix.dumps(sys.stdout.fuleno())
8+
9+
# 加載二進制文件
10+
proj = angr.Project('./login')
11+
12+
init_state = proj.factory.entry_state()
13+
14+
simulation = proj.factory.simgr(init_state)
15+
16+
simulation.explore(find=successful, avoid=fail)
17+
18+
solution = simulation.found[0]
19+
20+
print(solution.posix.dumps(sys.stdin.fileno()))

0 commit comments

Comments
 (0)