Skip to content

Commit 9c5a2a1

Browse files
authored
Update sol.py
1 parent c89d575 commit 9c5a2a1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lab7/sol.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import angr
2-
32
import sys
4-
53
proj = angr.Project('./login')
64
init_state = proj.factory.entry_state()
5+
76
simulation = proj.factory.simgr(init_state)
87

98
def success_condition(state):
@@ -14,6 +13,9 @@ def fail_condition(state):
1413

1514
simulation.explore(find=success_condition, avoid=fail_condition)
1615

17-
solution = simulation.found[0]
18-
19-
print(solution.posix.dumps(sys.stdin.fileno()))
16+
if simulation.found:
17+
solution = simulation.found[0]
18+
password = solution.posix.dumps(sys.stdin.fileno()).strip()
19+
print(password.decode())
20+
else:
21+
print("Password not found.")

0 commit comments

Comments
 (0)