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

Function force_arp_scan

webapp_modern.py:7965–8013  ·  view source on GitHub ↗

Force an ARP scan and update the cache manually for debugging

()

Source from the content-addressed store, hash-verified

7963 # This endpoint now returns cached data instantly for fast dashboard loading
7964
7965 status_data = {
7966 'ragnar_status': safe_str(shared_data.ragnarstatustext),
7967 'ragnar_status2': safe_str(shared_data.ragnarstatustext2),
7968 'ragnar_says': safe_str(shared_data.ragnarsays),
7969 'orchestrator_status': safe_str(shared_data.ragnarorch_status),
7970 'automation_enabled': is_orchestrator_running(),
7971 'target_count': safe_int(shared_data.targetnbr),
7972 'port_count': safe_int(shared_data.portnbr),
7973 'vulnerability_count': safe_int(shared_data.vulnnbr),
7974 'credential_count': safe_int(shared_data.crednbr),
7975 'data_count': safe_int(shared_data.datanbr),
7976 'level': safe_int(shared_data.levelnbr),
7977 'points': safe_int(shared_data.coinnbr),
7978 'coins': safe_int(shared_data.coinnbr),
7979 'scanned_network_count': safe_int(getattr(shared_data, 'scanned_networks_count', 0)),
7980 'wifi_connected': safe_bool(shared_data.wifi_connected),
7981 'current_ssid': safe_str(getattr(shared_data, 'current_wifi_ssid', '') or get_current_wifi_ssid() or ''),
7982 'ethernet_connected': safe_bool(is_ethernet_available()),
7983 'ethernet_ip': _get_active_ethernet_ip(),
7984 'ethernet_interface': _get_active_ethernet_name(),
7985 'bluetooth_active': safe_bool(shared_data.bluetooth_active),
7986 'pan_connected': safe_bool(shared_data.pan_connected),
7987 'usb_active': safe_bool(shared_data.usb_active),
7988 'manual_mode': safe_bool(shared_data.config.get('manual_mode', False)),
7989 'headless_mode': safe_bool(getattr(shared_data, 'headless_mode', False)),
7990 'pwnagotchi_mode': shared_data.config.get('pwnagotchi_mode', 'ragnar'),
7991 'pwnagotchi_installed': safe_bool(shared_data.config.get('pwnagotchi_installed', False)),
7992 'release_gate': _build_release_gate_payload(),
7993 'timestamp': datetime.now().isoformat()
7994 }
7995
7996 # Compact power/under-voltage summary so the dashboard badge can light
7997 # without its own poll. assess() is cached ~15s and never raises, so
7998 # this stays cheap even though /api/status is polled every few seconds.
7999 try:
8000 import power_budget
8001 status_data['power'] = power_budget.summary()
8002 except Exception as _pe:
8003 logger.debug(f"power summary unavailable: {_pe}")
8004
8005 # Add cache headers for quick responses
8006 response = jsonify(status_data)
8007 response.headers['Cache-Control'] = 'public, max-age=5' # Cache for 5 seconds
8008 return response
8009 except Exception as e:
8010 logger.error(f"Error getting status: {e}")
8011 return jsonify({'error': str(e)}), 500
8012
8013
8014@app.route('/api/config', methods=['GET'])
8015def get_config():
8016 """Get current configuration"""

Callers

nothing calls this directly

Calls 7

run_arp_scan_localnetFunction · 0.85
_get_wifi_ifaceFunction · 0.85
update_netkb_entryFunction · 0.85
appendMethod · 0.80
errorMethod · 0.80
itemsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected