File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python3
2
2
3
- import angr ,sys
3
+ import sys
4
+
5
+ import angr
6
+
7
+ angr .loggers .disable_root_logger ()
8
+
9
+
10
+ def found_flag (state : angr .SimState ):
11
+ return b"flag" in state .posix .dumps (1 )
12
+
4
13
5
14
def main ():
6
- secret_key = b""
7
- sys .stdout .buffer .write (secret_key )
15
+ proj = angr .Project ("./chal" , auto_load_libs = False )
16
+ state = proj .factory .entry_state (stdin = angr .SimFile )
17
+ simgr = proj .factory .simgr (state )
18
+ simgr .explore (find = found_flag )
19
+ if simgr .found :
20
+ found_state = simgr .found [0 ]
21
+ input_data = found_state .posix .dumps (0 )
22
+ sys .stdout .buffer .write (input_data )
23
+ else :
24
+ print ("No solution found" , file = sys .stderr )
25
+ exit (1 )
8
26
9
27
10
- if __name__ == ' __main__' :
28
+ if __name__ == " __main__" :
11
29
main ()
You can’t perform that action at this time.
0 commit comments