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

Method _detect_hardware

server_capabilities.py:125–164  ·  view source on GitHub ↗

Detect CPU and memory specifications

(self)

Source from the content-addressed store, hash-verified

123 # Tool definitions for advanced features
124 TRAFFIC_ANALYSIS_TOOLS = {
125 'tcpdump': {'package': 'tcpdump', 'critical': True},
126 'tshark': {'package': 'tshark', 'critical': False},
127 'ngrep': {'package': 'ngrep', 'critical': False},
128 'iftop': {'package': 'iftop', 'critical': False},
129 'nethogs': {'package': 'nethogs', 'critical': False},
130 'ss': {'package': 'iproute2', 'critical': True},
131 }
132
133 VULN_ASSESSMENT_TOOLS = {
134 'nmap': {'package': 'nmap', 'critical': True},
135 'nuclei': {'package': 'nuclei', 'critical': False, 'install_cmd': 'go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest'},
136 'nikto': {'package': 'nikto', 'critical': False},
137 'sqlmap': {'package': 'sqlmap', 'critical': False},
138 'hydra': {'package': 'hydra', 'critical': False},
139 'whatweb': {'package': 'whatweb', 'critical': False},
140 }
141
142 def __init__(self, shared_data=None):
143 self.shared_data = shared_data
144 self.capabilities = SystemCapabilities()
145 self._lock = threading.Lock()
146 self._detection_complete = False
147
148 # Detect capabilities on init
149 self.detect_capabilities()
150
151 def detect_capabilities(self) -> SystemCapabilities:
152 """Detect system hardware and software capabilities"""
153 with self._lock:
154 try:
155 self._detect_hardware()
156 self._detect_os_info()
157 self._check_tool_availability()
158 self._determine_feature_flags()
159 self._detection_complete = True
160
161 logger.info(f"Server capabilities detected: arch={self.capabilities.architecture}, "
162 f"ram={self.capabilities.total_ram_gb:.1f}GB, cores={self.capabilities.cpu_cores}, "
163 f"server_capable={self.capabilities.is_server_capable}")
164
165 except Exception as e:
166 logger.error(f"Error detecting capabilities: {e}")
167

Callers 1

detect_capabilitiesMethod · 0.95

Calls 3

_detect_ram_from_procMethod · 0.95
_detect_pi_zeroMethod · 0.95
debugMethod · 0.80

Tested by

no test coverage detected