File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ # author: greyshell
4+ # how to use: python test_pwn_utils_lib.py -m true local -b vuln -g true
5+
6+ from pwn import *
7+ from pwn_utils import PwnUtils
8+
9+
10+ def exploit (conn ):
11+ """
12+ interact with the binary with some valid input
13+ """
14+ print ("success" )
15+
16+
17+ def main ():
18+ my_input = PwnUtils ()
19+ arguments = my_input .parser .parse_args ()
20+ connection = ""
21+
22+ # run the script without any argument
23+ if len (sys .argv ) == 1 :
24+ my_input .parser .print_help (sys .stderr )
25+ sys .exit (1 )
26+
27+ # exploiting local binary
28+ if arguments .command == 'local' :
29+ binary_name = "./"
30+ binary_name += arguments .binary
31+ connection = process ([binary_name ])
32+ # attach the binary with gdb in tmux session
33+ if arguments .gdb == 'true' :
34+ gdb .attach (connection )
35+
36+ elif arguments .command == 'network' :
37+ connection = remote (arguments .ip_address , arguments .port )
38+
39+ if arguments .debug_mode == 'true' :
40+ context .log_level = 'debug'
41+
42+ # invoke the exploit function
43+ exploit (connection )
44+
45+
46+ if __name__ == '__main__' :
47+ main ()
You can’t perform that action at this time.
0 commit comments