-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecuritySystemMonitoringAPI.py
More file actions
62 lines (39 loc) · 1.25 KB
/
Copy pathsecuritySystemMonitoringAPI.py
File metadata and controls
62 lines (39 loc) · 1.25 KB
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
import json
from fastapi import FastAPI
app = FastAPI()
blacklisted_ips = ["192.168.1.5", "10.0.0.99"]
firewall_logs = [
{"timestamp" : "07:00", "event" : "Brute Force Attack", "severity" : "HEIGH"},
{"timestamp" : "07:05", "event" : "Port Scan Detected", "severity" : "MEDIUM"}
]
@app.get("/status")
def status_request():
return {"status" : "online"}
@app.get("/system-info")
def get_info():
return {
"api_vesion" : "1.0.0",
"security_level" : "maximum",
"hardware": {
"cpu_load_precent" : 12,
"ram_usage_gb" : 4
}
}
@app.get("/active-nodes")
def get_nodes():
return {
"total_active" : 3,
"locations" : ["Amsterdam", "Brabant", "Rotterdam"]
}
@app.get("/security/blacklist")
def get_blacklist():
return {"total_block" : 2, "ips" : blacklisted_ips}
@app.get("/security/logs")
def get_logs():
return {"total_logs" : 2, "events" : firewall_logs}
@app.get("/server/{server_id}")
def get_specific_server(server_id: int):
return {"message": f"Right now, you're watching server {server_id}"}
@app.get("/network/{country}/{node_id}")
def search_country_id(country: str, node_id: int):
return {"message": f"Country: {country}, Node: {node_id}"}