forked from picoCTF/picoCTF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
executable file
·52 lines (45 loc) · 1.15 KB
/
run.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
# !/usr/bin/env python3
"""picoCTF Web API initialization script."""
from argparse import ArgumentParser
import api
import api.submissions
def main():
"""Parse web API startup flags."""
parser = ArgumentParser(description="CTF API configuration")
parser.add_argument(
"-p",
"--port",
action="store",
help="port the server should listen on.",
type=int,
default=8000,
)
parser.add_argument(
"-l",
"--listen",
action="store",
help="host the server should listen on.",
default="0.0.0.0",
)
parser.add_argument(
"-d",
"--debug",
action="store_true",
help="run the server in debug mode.",
default=False,
)
parser.add_argument(
"-k",
"--debug-key",
action="store",
help="debug key for problem grading; only applies if debug is enabled",
type=str,
default=None,
)
args = parser.parse_args()
if args.debug:
api.submissions.DEBUG_KEY = args.debug_key
api.create_app().run(
host=args.listen, port=args.port, debug=args.debug,
)
main()