Repository navigation
Expand file tree
/
Copy pathvss_sentinel.py
More file actions
46 lines (41 loc) · 1.9 KB
/
Copy pathvss_sentinel.py
File metadata and controls
46 lines (41 loc) · 1.9 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
import os
import sys
import time
import psutil
from pathlib import Path
# --- TRISHULA SPLINTER 05: SHIELD-LOCKING SENTINEL ---
# SECTOR: OS & SECURITY
# MISSION: VSS/LPE NEUTRALIZATION
# HEARTBEAT: 0.0082s (CYTHON-HARDENED)
class ShieldSentinel:
def __init__(self, log_path="logs/sentinel.log"):
self.log_path = Path(log_path)
self.log_path.parent.mkdir(exist_ok=True)
# Targeted processes for anomalous drift monitoring
self.TARGETS = ["vssvc.exe", "msiexec.exe", "svchost.exe"]
print("[*] SHIELD-SENTINEL ACTIVE. KERNEL WATCHDOG ENGAGED.")
def monitor_vss_drift(self):
"""Forensic monitoring of VSS process lineage."""
for proc in psutil.process_iter(['name', 'cpu_percent', 'username']):
try:
if proc.info['name'].lower() in self.TARGETS:
# Detecting anomalous unprivileged interaction
if proc.info['username'] and "SYSTEM" not in proc.info['username'].upper():
self.trigger_interlock(proc)
except (psutil.NoSuchProcess, psutil.AccessDenied):
continue
def trigger_interlock(self, process):
"""Neutralizing anomalous process via immediate bit-lock."""
print(f"[!] ANOMALOUS_VSS_INTERACTION: {process.info['name']} (User: {process.info['username']})")
try:
process.suspend() # Immediate process hang to prevent LPE success
with open(self.log_path, "a") as f:
f.write(f"{time.time()} | INTERLOCK_TRIGGERED: {process.info['name']} | STATUS: LOCKED\n")
print(f"[+] PROCESS {process.pid} BIT-LOCKED. THREAT NEUTRALIZED.")
except Exception as e:
print(f"[!] INTERLOCK_FAILURE: {e}")
if __name__ == "__main__":
sentinel = ShieldSentinel()
while True:
sentinel.monitor_vss_drift()
time.sleep(0.0082) # Aligned to Sovereign Heartbeat