We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2949af2 commit 74962e8Copy full SHA for 74962e8
1 file changed
lab8/solve.py
@@ -1,11 +1,22 @@
1
-#!/usr/bin/env python3
2
-
3
-import angr,sys
+import angr
+import sys
4
5
def main():
6
- secret_key = b""
7
- sys.stdout.buffer.write(secret_key)
+ angr.loggers.disable_root_logger()
+
+ proj = angr.Project("chal")
8
+ state = proj.factory.entry_state(stdin=angr.SimFile)
9
+ simgr = proj.factory.simulation_manager(state)
10
11
+ simgr.explore(find=lambda s: b"Correct!" in s.posix.dumps(1),
12
+ avoid=lambda s: b"Wrong key!" in s.posix.dumps(1))
13
14
+ if len(simgr.found) > 0:
15
+ found_state = simgr.found[0]
16
+ solution = found_state.posix.dumps(0)
17
+ sys.stdout.buffer.write(solution)
18
+ else:
19
+ print("No solution found")
20
21
if __name__ == '__main__':
- main()
22
+ main()
0 commit comments