-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguardian.py
More file actions
55 lines (44 loc) · 1.75 KB
/
Copy pathguardian.py
File metadata and controls
55 lines (44 loc) · 1.75 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
#!/usr/bin/env python3
"""
Guardian — Lightweight free EDR for small teams.
Monitor processes, files, and network. Detect threats. View in dashboard.
"""
import os
import sys
import threading
import argparse
sys.path.insert(0, os.path.dirname(__file__))
from agent.monitor import Guardian, run_agent
from dashboard.app import run as run_dashboard
def main():
parser = argparse.ArgumentParser(description="Guardian — Free EDR")
parser.add_argument("--headless", action="store_true", help="Run without dashboard")
parser.add_argument("--port", type=int, default=5000, help="Dashboard port")
parser.add_argument("--duration", type=int, help="Run for N seconds then exit")
args = parser.parse_args()
print("""
╔══════════════════════════════╗
║ Guardian — Free EDR ║
║ Lightweight threat detection ║
╚══════════════════════════════╝
""")
g = run_agent(duration=args.duration)
if not args.headless and args.duration is None:
print(f"\nStarting dashboard at http://127.0.0.1:{args.port}")
dashboard_thread = threading.Thread(
target=run_dashboard, args=(g,), kwargs={"port": args.port},
daemon=True
)
dashboard_thread.start()
try:
while True:
import time
time.sleep(1)
except KeyboardInterrupt:
print("\nShutting down")
print(f"\nCollected {len(g.alerts)} alerts total")
high = [a for a in g.alerts if a["severity"] == "high"]
if high:
print(f"⚠️ {len(high)} high-severity alerts found")
if __name__ == "__main__":
main()