-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_securezone.py
More file actions
51 lines (36 loc) · 1.35 KB
/
Copy pathtest_securezone.py
File metadata and controls
51 lines (36 loc) · 1.35 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
import requests
import json
import time
BASE_URL = "http://localhost:5000"
def test_endpoint(name, method, endpoint, data=None):
print(f"\n{'='*60}")
print(f"Testing: {name}")
print(f"{'='*60}")
try:
if method == "GET":
response = requests.get(f"{BASE_URL}{endpoint}", timeout=5)
else:
response = requests.post(f"{BASE_URL}{endpoint}", json=data, timeout=5)
print(f"Status Code: {response.status_code}")
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2)[:800])
else:
print(f"Error: {response.text}")
except Exception as e:
print(f"Exception: {str(e)}")
print("\n🚀 Starting SecureZone Advanced API Tests\n")
test_endpoint("System Status", "GET", "/api/status")
time.sleep(1)
test_endpoint("Quick Scan", "POST", "/api/run_scan", {"scan_type": "quick"})
time.sleep(1)
test_endpoint("Get Alerts", "GET", "/api/alerts")
time.sleep(1)
test_endpoint("Advanced Metrics", "GET", "/api/advanced_metrics")
time.sleep(1)
test_endpoint("Detection Layers", "GET", "/api/detection_layers")
time.sleep(1)
test_endpoint("Network Topology", "GET", "/api/network")
time.sleep(1)
test_endpoint("Deep Scan", "POST", "/api/run_scan", {"scan_type": "deep"})
print("\n✅ All tests completed!")