Detect system capabilities and manage server-mode features. Server mode is enabled when: - Architecture is AMD64 or ARM64 (or armv8l in 32-bit mode on 64-bit Pi) - System has at least 7.5GB RAM (allows for system reserved) - Not running on Pi Zero
| 59 | advanced_vuln_enabled: bool = False |
| 60 | parallel_scanning_enabled: bool = False |
| 61 | local_ai_enabled: bool = False |
| 62 | large_dictionaries_enabled: bool = False |
| 63 | |
| 64 | # Tool availability |
| 65 | available_tools: Dict[str, bool] = field(default_factory=dict) |
| 66 | |
| 67 | def to_dict(self) -> Dict[str, Any]: |
| 68 | return asdict(self) |
| 69 | |
| 70 | |
| 71 | class ServerCapabilities: |
| 72 | """ |
| 73 | Detect system capabilities and manage server-mode features. |
| 74 | |
| 75 | Server mode is enabled when: |
| 76 | - Architecture is AMD64 or ARM64 (or armv8l in 32-bit mode on 64-bit Pi) |
| 77 | - System has at least 7.5GB RAM (allows for system reserved) |
| 78 | - Not running on Pi Zero |
| 79 | """ |
| 80 | |
| 81 | # Minimum requirements for server mode |
| 82 | # Use 7.5GB to account for system reserved memory on 8GB devices |
| 83 | MIN_RAM_GB = 7.5 |
| 84 | MIN_CORES = 2 |
| 85 | # The on-screen kiosk drives a full Chromium, which needs ~1GB resident on |
| 86 | # its own. A Pi Zero 2 W has 512MB total, so the kiosk there thrashes swap |
| 87 | # and the whole box crawls — Ragnar's own scanning included. Chromium runs |
| 88 | # fine from 2GB up, so the kiosk floor is its own bar rather than full |
| 89 | # server mode (a 4GB Pi 4/5 with a screen is a perfectly good kiosk host). |
| 90 | # 1.8 rather than 2.0 for the same reason MIN_RAM_GB is 7.5 rather than 8: |
| 91 | # firmware/kernel reservations mean a real 2GB Pi 4 reports ~1.9GB. |
| 92 | KIOSK_MIN_RAM_GB = 1.8 |
| 93 | KIOSK_MIN_CORES = 2 |
| 94 | # Traffic Analysis is a tcpdump pipe read line by line in Python. Measured |
| 95 | # on a Pi 5 against a live LAN at ~90 packets/sec: 0.4% of one core, 18MB |
| 96 | # RSS for the analyzer and 8MB for tcpdump. That is a Pi Zero 2 W workload, |
| 97 | # not a server one - so it gets its own floor rather than server mode's |
| 98 | # 7.5GB. Kept above zero only to fail closed when RAM cannot be read; a |
| 99 | # 512MB Zero 2 W reports ~0.42GB after the GPU split. |
| 100 | TRAFFIC_MIN_RAM_GB = 0.3 |
| 101 | TRAFFIC_MIN_CORES = 1 |
| 102 | # The JA3 and IRC sidecars are the exception: each spawns a full tshark |
| 103 | # dissector (measured ~290MB RSS each, plus a ~155MB dumpcap child), so the |
| 104 | # pair costs more than a Zero has in total. They stay a big-board feature |
| 105 | # while the tcpdump core runs everywhere. |
| 106 | TRAFFIC_SIDECAR_MIN_RAM_GB = 3.5 |
| 107 | # Include armv8l which is 32-bit userspace on 64-bit ARM (Pi 4/5 with 32-bit OS) |
| 108 | SUPPORTED_ARCHS = ['x86_64', 'amd64', 'aarch64', 'arm64', 'armv8l', 'armv7l'] |
| 109 | |
| 110 | # Tool definitions for advanced features |
| 111 | TRAFFIC_ANALYSIS_TOOLS = { |
| 112 | 'tcpdump': {'package': 'tcpdump', 'critical': True}, |
| 113 | 'tshark': {'package': 'tshark', 'critical': False}, |
| 114 | 'ngrep': {'package': 'ngrep', 'critical': False}, |
| 115 | 'iftop': {'package': 'iftop', 'critical': False}, |
| 116 | 'nethogs': {'package': 'nethogs', 'critical': False}, |
| 117 | 'ss': {'package': 'iproute2', 'critical': True}, |
| 118 | } |
no outgoing calls
no test coverage detected