File tree Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,9 @@ test('Application: notifySelected()', () => {
9292 mockWrite . mock . restore ( ) ;
9393 mockSend . mock . restore ( ) ;
9494} ) ;
95- = === ===
9695const { Application, MailSystem } = require ( './main' ) ;
9796
9897// TODO: write your tests here
9998// Remember to use Stub, Mock, and Spy when necessary
99+
100+ const { Application, MailSystem } = require ( './main' ) ;
Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
22
3- import angr ,sys
3+ import angr
4+ import claripy
5+ import sys
46
5- def main ():
6- secret_key = b""
7- sys .stdout .buffer .write (secret_key )
7+ def solve_binary (binary_path , input_len = 8 , success_msg = b"Correct!" ):
8+ proj = angr .Project (binary_path , auto_load_libs = False )
9+
10+ user_input = claripy .BVS ("user_input" , input_len * 8 )
11+ state = proj .factory .full_init_state (stdin = user_input )
12+
13+ simgr = proj .factory .simulation_manager (state )
14+
15+ def is_successful (s ):
16+ output = s .posix .dumps (sys .stdout .fileno ())
17+ return success_msg in output
818
19+ simgr .explore (find = is_successful )
20+
21+ if simgr .found :
22+ solution_state = simgr .found [0 ]
23+ result = solution_state .solver .eval (user_input , cast_to = bytes )
24+ return result [:input_len ]
25+ else :
26+ return b"[!] Not found\n "
27+
28+ def main ():
29+ binary = "./chal"
30+ flag = solve_binary (binary )
31+ sys .stdout .buffer .write (flag )
932
10- if __name__ == ' __main__' :
33+ if __name__ == " __main__" :
1134 main ()
You can’t perform that action at this time.
0 commit comments