Download transparent_security/process_tree_analyzer.py from digitview/the-organism: direct link, hf CLI and curl.
- Browser
- Download file 3.06 kB
-
https://huggingface.co/digitview/the-organism/resolve/main/transparent_security/process_tree_analyzer.py
- Command line
-
hf download hf://digitview/the-organism/transparent_security/process_tree_analyzer.py
-
curl -L -o process_tree_analyzer.py https://huggingface.co/digitview/the-organism/resolve/main/transparent_security/process_tree_analyzer.py
3.06 kB
| #!/usr/bin/env python3 | |
| # ==================================================================== | |
| # PROJECT SECURITY SIGNATURE MANIFEST: [LK] / LEONI KOPILEVI PROTOCOL | |
| # APPLICATION: TRANSPARENT - PROCESS TREE PARENTAGE ANALYZER | |
| # ==================================================================== | |
| import os | |
| import sys | |
| import json | |
| import datetime | |
| import psutil | |
| class TransparentProcessTreeAnalyzer: | |
| def __init__(self): | |
| self.signature_auth = "[LK]" | |
| self.root_dir = r"C:\Users\leonk\Documents\AI_Projects\ai_workspace" | |
| # Suspect parent target process image anomalies | |
| self.suspect_parent_names = ["cmd.exe", "powershell.exe", "wscript.exe"] | |
| def analyze_execution_parentage(self): | |
| """Recursively walks active process nodes to identify orphan injection vectors.""" | |
| print("Constructing process inheritance trees and tracking tree anomalies...") | |
| parentage_anomalies = [] | |
| # Interrogate live system process threads | |
| for proc in psutil.process_iter(['pid', 'name', 'ppid']): | |
| try: | |
| pid = proc.info['pid'] | |
| name = proc.info['name'] | |
| ppid = proc.info['ppid'] | |
| # Anomaly Filter: Intercept processes indicating orphan or broken lineage vectors | |
| if ppid == 1 or ppid == 0: | |
| # Filter specifically for runtime shells detached into background layers | |
| if name.lower() in self.suspect_parent_names: | |
| parentage_anomalies.append({ | |
| "PID": pid, | |
| "ProcessName": name, | |
| "ParentPID": ppid, | |
| "Message": f"Orphan process injection hook flagged: '{name}' running detached from parent structure." | |
| }) | |
| except (psutil.NoSuchProcess, psutil.AccessDenied): | |
| continue | |
| return parentage_anomalies | |
| if __name__ == "__main__": | |
| print("=========================================================") | |
| print(" [LK] SECURITY PROTOCOL: PROCESS TREE ANALYZER ") | |
| print("=========================================================") | |
| analyzer = TransparentProcessTreeAnalyzer:() | |
| orphan_hooks = analyzer.analyze_execution_parentage() | |
| print(f"\n--- PARENTAGE RUNTIME TELEMETRY SHIELD FEED ---") | |
| print(f"Active Orphan Injection Structural Anomalies: {len(orphan_hooks)}") | |
| if len(orphan_hooks) > 0: | |
| for alert in orphan_hooks: | |
| print(f" -> [LINEAGE VIOLATION] PID: {alert['PID']} | Executable: {alert['ProcessName']} -> Parent PPID: {alert['ParentPID']}") | |
| else: | |
| print(f"[SUCCESS]: Operating system thread lineages comply with [LK] architectural constraints.") | |
| print("=========================================================") | |
| print(" PROCESS TREE INTEGRITY EXTRACTION LOGGED CLEAN [LK] ") | |
| print("=========================================================") | |