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

Function start_traffic_capture

webapp_modern.py:16951–16979  ·  view source on GitHub ↗

Start traffic capture

()

Source from the content-addressed store, hash-verified

16949
16950# ==============================================================================
16951# Ethernet/LAN API Endpoints
16952# ==============================================================================
16953
16954@app.route('/api/ethernet/status', methods=['GET'])
16955def get_ethernet_status():
16956 """Get current Ethernet interface status."""
16957 try:
16958 state = _get_multi_interface_state()
16959 # Refresh Ethernet interfaces
16960 state.refresh_ethernet_interfaces()
16961 status = state.get_ethernet_status()
16962 # Add ethernet preference setting
16963 status['prefer_ethernet'] = shared_data.config.get('ethernet_prefer_over_wifi', True)
16964 return jsonify({'success': True, **status})
16965 except Exception as exc:
16966 logger.error(f"Failed to get Ethernet status: {exc}")
16967 return jsonify({'success': False, 'error': str(exc)}), 500
16968
16969
16970@app.route('/api/ethernet/interfaces', methods=['GET'])
16971def get_ethernet_interfaces():
16972 """Get all Ethernet interfaces."""
16973 try:
16974 default_eth = shared_data.config.get('ethernet_default_interface', 'eth0')
16975 interfaces = gather_ethernet_interfaces(default_eth)
16976 return jsonify({
16977 'success': True,
16978 'interfaces': interfaces,
16979 'default_interface': default_eth,
16980 })
16981 except Exception as exc:
16982 logger.error(f"Failed to get Ethernet interfaces: {exc}")

Callers

nothing calls this directly

Calls 5

errorMethod · 0.80
get_traffic_analyzerFunction · 0.70
is_availableMethod · 0.45
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected