-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
executable file
·98 lines (80 loc) · 2.53 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import threading
import serviceguards
from activators import activate
# from ui import ledger
# from utils import OutputHandler
# import curses
# import queue
import signal
import os
import subprocess
panel = None
exiting = False
# outHand = OutputHandler().getInstance()
def keyboardInterruptHandler(signal, frame):
global exiting
# panel.close()
if not exiting:
exiting = True
kill_infra = input("Do you want to stop docker containers? [Y/n]: ")
if kill_infra.upper() == "Y":
print("[Main] Starting containers termination...")
serviceguards.elkstack.stop()
serviceguards.redistimeseries.stop()
print("[Main] Containers terminated.")
serviceguards.beatsforwarder.stop()
serviceguards.xssauditor.stop()
# os.system("reset")
exit(0)
else:
print("[Main] Already exiting... Please wait.")
def menu():
setup = -1
while True:
os.system("clear")
print("Nethive, a SIEMxCVSS Project\n")
print("[1] Check Dependencies")
print("[2] Refresh Configuration")
print("[3] Run Nethive")
print("[4] Exit")
setup = input(">> ")
if setup == "1":
# check if dependencies are already installed
print("Checking Filebeat...")
time.sleep(0.5)
print("OK")
print("Checking Auditbeat...")
time.sleep(0.3)
print("OK")
print("Checking Packetbeat...")
time.sleep(0.7)
print("OK")
print("Checking Docker and docker-compose...")
time.sleep(1)
print("OK")
pass
elif setup == "2":
activate.configs()
elif setup == "3":
return
elif setup == "4":
exit(0)
else:
print("Invalid input, please try again.")
input("Press [enter] to continue...")
if __name__ == "__main__":
# --- Set signal handlers
signal.signal(signal.SIGINT, keyboardInterruptHandler)
# --- Dependency and configuration management
menu()
# --- Activating Nethive Engines
serviceguards.elkstack.run()
# serviceguards.kafkaserver.run()
serviceguards.redistimeseries.run()
serviceguards.inspectioncontroller.run()
serviceguards.httpsniffer.run()
serviceguards.xssauditor.run()
serviceguards.slogparser.run()
serviceguards.threlkengine.run()
serviceguards.beatsforwarder.run()
print("[Main] Nethive SIEM is active.")