MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / install_missing_tools

Method install_missing_tools

server_capabilities.py:298–346  ·  view source on GitHub ↗

Attempt to install missing tools for a feature

(self, feature: str)

Source from the content-addressed store, hash-verified

296 # Traffic Analysis is deliberately not in this list - see above.
297 caps.advanced_vuln_enabled = False
298 caps.parallel_scanning_enabled = False
299 caps.local_ai_enabled = False
300 caps.large_dictionaries_enabled = False
301
302 def _evaluate_kiosk_support(self) -> Tuple[bool, str]:
303 """Can this box host the on-screen kiosk (Chromium fullscreen)?
304
305 Returns (capable, reason). `reason` is empty when capable and is shown
306 verbatim in the UI/installer otherwise, so it has to name the board's
307 actual numbers - "not supported" alone sends people hunting.
308 """
309 caps = self.capabilities
310 ram_gb = caps.total_ram_gb
311
312 if caps.is_pi_zero:
313 return False, (
314 f"Kiosk needs a Ragnar Pi server. This is a Pi Zero class board "
315 f"({ram_gb:.1f}GB RAM) and Chromium alone needs about 1GB."
316 )
317 # A RAM read of 0 means /proc/meminfo and psutil both failed. Don't hand
318 # a kiosk to a box we know nothing about.
319 if ram_gb <= 0:
320 return False, "Kiosk needs a Ragnar Pi server. Could not read this system's RAM size."
321 if ram_gb < self.KIOSK_MIN_RAM_GB:
322 return False, (
323 "Kiosk needs a Ragnar Pi server with at least 2GB RAM. "
324 f"This board has {ram_gb:.1f}GB and Chromium alone needs about 1GB."
325 )
326 if caps.cpu_cores < self.KIOSK_MIN_CORES:
327 return False, (
328 f"Kiosk needs at least {self.KIOSK_MIN_CORES} CPU cores. "
329 f"This board has {caps.cpu_cores}."
330 )
331 return True, ""
332
333 def _evaluate_traffic_support(self) -> Tuple[bool, str]:
334 """Can this box run Traffic Analysis (tcpdump capture + parsing)?
335
336 Returns (capable, reason), same contract as _evaluate_kiosk_support:
337 `reason` is empty when capable and is shown verbatim otherwise.
338
339 Unlike the vulnerability scanners this needs no dictionaries, no
340 parallel scan fleet and no dissector - just a tcpdump pipe - so a Pi
341 Zero passes. The only hard requirement is tcpdump itself.
342 """
343 caps = self.capabilities
344 ram_gb = caps.total_ram_gb
345
346 if not caps.available_tools.get('tcpdump', False):
347 return False, (
348 "Traffic Analysis needs tcpdump, which is not installed. "
349 "Install it with: sudo apt-get install tcpdump"

Callers 1

install_server_toolsFunction · 0.80

Calls 6

get_missing_toolsMethod · 0.95
appendMethod · 0.80
errorMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected