File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import angr ,sys
44
55def main ():
6- secret_key = b""
7- sys .stdout .buffer .write (secret_key )
6+ project = angr .Project ('./chal' , auto_load_libs = False )
7+
8+ # Start the analysis at main
9+ state = project .factory .entry_state ()
10+
11+ # Create a simulation manager
12+ simgr = project .factory .simulation_manager (state )
13+
14+ # Explore until we reach the "Correct!" message
15+ simgr .explore (find = lambda s : b"Correct!" in s .posix .dumps (1 ))
16+
17+ # Ensure we found a solution
18+ if simgr .found :
19+ solution_state = simgr .found [0 ]
20+
21+ # Extract the secret key from stdin
22+ secret_key = solution_state .posix .dumps (0 ).split (b"\n " )[0 ]
23+
24+ # Output the secret key to stdout
25+ sys .stdout .buffer .write (secret_key + b"\n " )
26+ else :
27+ print ("Solution not found." )
828
929
1030if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments