-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathctf-tool.py
More file actions
executable file
·36 lines (27 loc) · 846 Bytes
/
ctf-tool.py
File metadata and controls
executable file
·36 lines (27 loc) · 846 Bytes
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 python3
import argparse
import sys
from src import ascii_art
from src.commands import command_dict
from src.tui import log_error
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument("command",
help="command to run",
choices=[cmd for cmd in command_dict if not command_dict[cmd].hidden])
return parser
def main():
# Art
#print(ascii_art)
# Parser args
parser = get_parser()
args = parser.parse_args(sys.argv[1:2])
# run command action
try:
selected_command = command_dict[args.command]
return selected_command().run_command(sys.argv[2:])
except Exception as e:
log_error(str(e)) # Nicer display on error
raise # Shows traceback
if __name__ == "__main__":
quit(main())