-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
45 lines (37 loc) · 1.2 KB
/
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
37
38
39
40
41
42
43
44
45
import sys
from autokd.extractor import extractor
from autokd.kbuilder import kbuilder
# from autokd.kdocker import kdocker
from autokd.checker import checker
from autokd.krunner import krunner
from autokd.initrd import initrd
from autokd.config import config
import autokd.utils.printer as printer
def run():
if config.ctfopts.enabled:
printer.fatal("ctf option is conflict with `./akd run`")
checker.proxy()
kbuilder.download().unpack().compile()
initrd.unpack().compile_exp().pack()
krunner.make_run_script().run()
# kbuilder.unpack()
# kbuilder.()
def ctf():
if not config.ctfopts.enabled:
printer.fatal("only enable ctf option in user.json can use ctf mode")
extractor.extract_vmlinux()
initrd.unpack().compile_exp().pack()
krunner.make_run_script().run()
if __name__ == "__main__":
if len(sys.argv) > 3 or len(sys.argv) < 2:
printer.fatal("Usage : python3 main.py <option>")
opt = sys.argv[1]
if len(sys.argv) == 3:
if sys.argv[2] == "skip":
config.msicopts.need_confirm = False
if opt == "run":
run()
elif opt == "ctf":
ctf()
else:
raise RuntimeError