File tree 1 file changed +17
-12
lines changed
1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change 1
1
import angr
2
+
2
3
import sys
3
- proj = angr .Project ('./login' , auto_load_libs = False )
4
- start_state = proj .factory .entry_state ()
5
- simgr = proj .factory .simgr (start_state )
6
-
7
- simgr .explore (find = lambda s : b'Login success' in s .posix .dumps (1 ))
8
-
9
- if simgr .found :
10
- solution_state = simgr .found [0 ]
11
- password = solution_state .posix .dumps (0 ).strip ()
12
- print (password .decode ())
13
- else :
14
- print ("Password not found." )
4
+
5
+ proj = angr .Project ('./login' )
6
+ init_state = proj .factory .entry_state ()
7
+ simulation = proj .factory .simgr (init_state )
8
+
9
+ def success_condition (state ):
10
+ return b"Login successful" in state .posix .dumps (sys .stdout .fileno ())
11
+
12
+ def fail_condition (state ):
13
+ return b"Login failed" in state .posix .dumps (sys .stdout .fileno ())
14
+
15
+ simulation .explore (find = success_condition , avoid = fail_condition )
16
+
17
+ solution = simulation .found [0 ]
18
+
19
+ print (solution .posix .dumps (sys .stdin .fileno ()))
You can’t perform that action at this time.
0 commit comments