-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.py
executable file
·77 lines (59 loc) · 2 KB
/
entrypoint.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
import argparse
import logging
import os
import subprocess
def main():
#------------------------------------------------------------------------------
# Configure Argparse to handle command line arguments
#------------------------------------------------------------------------------
desc = "msfconsole RPC web interface"
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('-U', '--username',
help='RPC Username',
default = os.environ.get('MSF_RPC_USER')
)
parser.add_argument('-P', '--password',
help='RPC Password',
default = os.environ.get('MSF_RPC_PASS')
)
parser.add_argument('-a', '--host',
help='RPC Host',
default = os.environ.get('MSF_RPC_HOST')
)
parser.add_argument('-p', '--port',
help='RPC Port',
default = os.environ.get('MSF_RPC_PORT')
)
if os.environ.get('MSF_RPC_SSL') is None:
disable_ssl = False
elif os.environ.get('MSF_RPC_SSL').lower == 'true':
disable_ssl = False
else:
disable_ssl = True
parser.add_argument('-S',
help='Disable SSL',
action="store_true",
dest='disable_ssl',
default=disable_ssl
)
args = parser.parse_args()
username = args.username
password = args.password
host = args.host
port = args.port
disable_ssl = args.disable_ssl
command = '/usr/bin/tini -- ttyd pymsfconsole.py'
if username:
command += ' -U ' + username
if password:
command += ' -P ' + password
if host:
command += ' -a ' + host
if port:
command += ' -p ' + port
if disable_ssl:
command += ' -S'
subprocess.Popen(command, shell=True).wait()
if __name__ == '__main__':
main()