-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
86 lines (65 loc) · 2.21 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
# main.py
from db_manager import insert_incident
import db_manager
import threat_detection
import soar_integration
import report_generator
import client_info
import pandas as pd
import matplotlib.pyplot as mp
def dict_to_list(dict_sent):
result_list = []
for key in dict_sent.keys():
result_list.append([key, dict_sent[key]])
# Total amounts of protocols found
# print(result_list)
return result_list
def show_chart(amount_found_dict):
# data to be plotted
data = dict_to_list(amount_found_dict)
# form dataframe from data
df = pd.DataFrame(data, columns=["Protocol", "Amount"])
# plot multiple columns such as population and year from dataframe
df.plot(
x="Protocol",
y="Amount",
kind="barh",
figsize=(10, 7),
title="Sniff Result Chart",
)
# Window icon and name
fig = mp.gcf()
mp.Figure()
fig_manager = mp.get_current_fig_manager()
fig_manager.window.wm_iconbitmap("C:\C Program\SentinelFusion\SentinelFusion.ico")
fig.canvas.manager.set_window_title("Sentinel Fusion")
# display plot
mp.show()
def main():
# Main function to orchestrate other modules
# Start network monitor
threat_detection.start_network_monitor()
# clint_info gets client ip address
client_ip_address = client_info.get_ip_address()
# print(client_ip_address)
show_chart(threat_detection.times_found_dict)
# Get all incidents from the database
print("Getting all incidents...")
incidents = db_manager.get_all_incidents()
# test
incident_details = {"status": "open", "details": "example.com"}
insert_incident(incident_details)
print(incidents)
# Get threat intelligence for each incident
# limit for 1 incidents and add threat intelligence to the incident, stop the loop
for incident in incidents:
threat_intelligence = soar_integration.get_threat_intelligence(
incident["details"]
)
incident["threat_intelligence"] = threat_intelligence
break
# Generate PDF report in the current directory
print("Generating PDF report...")
report_generator.generate_pdf_report(incident_details)
if __name__ == "__main__":
main()