/
tcp_proxy.py
54 lines (45 loc) · 1.26 KB
/
tcp_proxy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Windows Program Frida DBI
import frida
import sys, os
from tcp_proxy_core.tcp_proxy_config import *
from tcp_proxy_interface import dev_interface as dev
from tcp_proxy_interface import gui_interface as gui
from tcp_proxy_core.core_func import *
def main(target_process):
try:
session = frida.attach(target_process)
gui.print_info()
#dev.show_banner()
except Exception as e:
gui.print_error(str(e))
while True:
#cmd = dev.shell_loop()
cmd = gui.get_cmd()
if cmd == 'proxy':
if len(settings['capture_list']) != 0 :
for capture_api in settings['capture_list']:
hook_api(session,capture_api)
else:
gui.print_error("Empty capture_list")
elif cmd =="GET_SETTING":
try:
gui.cmd_response("get_setting","success",settings)
except Exception as e:
gui.cmd_response("get_setting","fail",str(e))
elif cmd == 'clear' or cmd == 'cls':
os.system('cls')
elif cmd.startswith("set"):
set_cmd(cmd)
elif cmd == 'exit':
#dev.exit_message()
sys.exit()
#sys.stdin.read()
if __name__ == '__main__':
if len(sys.argv) != 2:
print('Usage : %s <process name or PID>' % __file__)
sys.exit(1)
try:
target_process = int(sys.argv[1])
except:
target_process = sys.argv[1]
main(target_process)