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

Method _get_cached_page_data

display.py:777–791  ·  view source on GitHub ↗

Get cached page data, refreshing if older than ttl seconds.

(self, key, fetch_fn, ttl=10)

Source from the content-addressed store, hash-verified

775 try:
776 result = subprocess.run(['hostapd_cli', '-i', self._wifi_iface, 'list_sta'],
777 capture_output=True, text=True, timeout=2)
778 if result.returncode == 0:
779 clients = [line.strip() for line in result.stdout.strip().split('\n') if line.strip()]
780 client_count = len(clients)
781 if client_count > 0:
782 return f"AP: {client_count} client{'s' if client_count != 1 else ''}"
783 else:
784 return "AP: No clients"
785 else:
786 return "AP: Active"
787 except:
788 return "AP: Active"
789
790 logger.debug(f"[STATUS] WiFi not detected by any method")
791 return "WiFi: Disconnected"
792
793 except Exception as e:
794 logger.error(f"Error getting WiFi status text: {e}")

Callers 6

_render_netdiag_pageMethod · 0.95
_render_network_pageMethod · 0.95
_render_vuln_pageMethod · 0.95
_render_advanced_pageMethod · 0.95
_render_traffic_pageMethod · 0.95

Calls 2

debugMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected