-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
58 lines (39 loc) · 1.15 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
46
47
48
49
50
51
52
53
54
55
56
57
58
import time
import sys
import toml
from veve.log import Log
from veve.manager import Manager
from veve.session import Session
from veve import options as Options
def setup():
config = toml.load("config.toml")
log = Log()
log.setup_logging()
options, registry = Options.options()
if options.list_plugins:
print("Available plugins:")
for plugin_name, plugin in registry.items():
print(f"\t{plugin_name} - {plugin.description()}")
sys.exit(0)
if options.version:
print(f"{config['name']} v{config['version']}")
sys.exit(0)
print(f"{config['name']} v{config['version']}\n")
return options
def main():
opts = setup()
session = Session(opts)
manager = Manager(session)
manager.setup()
print(f"Running {opts.plugin} plugin...\n")
print(f"Loaded Targets: {manager.targets}\n")
start = time.perf_counter()
try:
manager.start()
except KeyboardInterrupt:
print("\n\nStopping...")
sys.exit(1)
finish = time.perf_counter()
print(f"\nFinished in {round(finish - start, 2)} second(s)")
if __name__ == "__main__":
main()