Compute lightweight stats for a single network directory.
(network_dir)
| 15851 | 'mesh_enabled': bool(mesh_available and _mesh_enabled())}) |
| 15852 | |
| 15853 | |
| 15854 | @app.route('/api/serial-console/clear', methods=['POST']) |
| 15855 | def api_serial_console_clear(): |
| 15856 | import serial_console |
| 15857 | return jsonify(serial_console.clear()) |
| 15858 | |
| 15859 | |
| 15860 | @app.route('/api/serial-console/scripts') |
| 15861 | def api_serial_console_scripts(): |
| 15862 | import serial_console |
| 15863 | return jsonify({'scripts': serial_console.list_scripts()}) |
| 15864 | |
| 15865 | |
| 15866 | @app.route('/api/serial-console/run-script', methods=['POST']) |
| 15867 | def api_serial_console_run_script(): |
| 15868 | import serial_console |
| 15869 | body = request.get_json(silent=True) or {} |
| 15870 | sid = (body.get('script_id') or '').strip() |
| 15871 | if not sid: |
| 15872 | return jsonify({'success': False, 'error': 'missing script_id'}), 400 |
| 15873 | return jsonify(serial_console.run_script(sid)) |
| 15874 | |
| 15875 | |
| 15876 | @app.route('/api/serial-console/script-status') |
| 15877 | def api_serial_console_script_status(): |
| 15878 | import serial_console |
| 15879 | return jsonify(serial_console.script_status()) |
| 15880 | |
| 15881 | |
| 15882 | @app.route('/api/ragnar-scripts/sync', methods=['POST']) |
| 15883 | def api_ragnar_scripts_sync(): |
| 15884 | """Clone or git-pull the external RagnarScripts library (throttled). |
| 15885 | |
| 15886 | Called when the Dashboard / Pentest tabs open so freshly-pushed shared |
| 15887 | scripts appear without a manual pull. Best-effort — a failure (offline, no |
| 15888 | git) is reported but never an error the UI must handle.""" |
| 15889 | try: |
| 15890 | import ragnar_scripts |
| 15891 | force = bool((request.get_json(silent=True) or {}).get('force')) |
| 15892 | return jsonify(ragnar_scripts.sync(force=force)) |
| 15893 | except Exception as e: |
| 15894 | logger.warning(f"RagnarScripts sync error: {e}") |
| 15895 | return jsonify({'ok': False, 'error': str(e)}) |
no test coverage detected