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

Function captive_portal_detection

webapp_modern.py:4804–4811  ·  view source on GitHub ↗

Handle captive portal detection requests from mobile devices

()

Source from the content-addressed store, hash-verified

4802 return jsonify({'success': False, 'error': 'Sensing backend is not installed.'}), 400
4803 cmd = (['systemctl', 'restart', SENSING_UNIT] if os.geteuid() == 0
4804 else ['sudo', '-n', 'systemctl', 'restart', SENSING_UNIT])
4805 try:
4806 proc = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
4807 except Exception as exc:
4808 return jsonify({'success': False, 'error': f'restart failed: {exc}'}), 500
4809 if proc.returncode != 0:
4810 return jsonify({'success': False,
4811 'error': (proc.stderr or proc.stdout or 'systemctl restart failed').strip()}), 500
4812 _, active = _sensing_unit_state()
4813 return jsonify({'success': True, 'active': active,
4814 'message': 'Sensing service restarted' + ('' if active else ' (not active — check logs)')})

Callers

nothing calls this directly

Calls 1

is_ap_client_requestFunction · 0.85

Tested by

no test coverage detected