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

Function get_network_files

webapp_modern.py:15896–15968  ·  view source on GitHub ↗

Return a flat list of files stored under a specific network's directory.

(slug)

Source from the content-addressed store, hash-verified

15894 logger.warning(f"RagnarScripts sync error: {e}")
15895 return jsonify({'ok': False, 'error': str(e)})
15896
15897
15898@app.route('/api/serial-console/library')
15899def api_serial_console_library():
15900 """List console scripts available in the cloned RagnarScripts repo."""
15901 import serial_console
15902 return jsonify(serial_console.list_library())
15903
15904
15905@app.route('/api/serial-console/library/install', methods=['POST'])
15906def api_serial_console_library_install():
15907 """Install a console script from the RagnarScripts repo into data/console_scripts/."""
15908 import serial_console
15909 body = request.get_json(silent=True) or {}
15910 sid = (body.get('script_id') or body.get('id') or '').strip()
15911 if not sid:
15912 return jsonify({'success': False, 'error': 'missing script_id'}), 400
15913 result = serial_console.install_library_script(sid)
15914 return jsonify(result), (200 if result.get('success') else 400)
15915
15916
15917@app.route('/api/power/test', methods=['GET', 'POST'])
15918def api_power_test():
15919 """Idle-vs-load power test. POST {duration, loads:[cpu,sdr,wifi]} starts
15920 it in the background; GET returns progress and the last result."""
15921 try:
15922 import power_tools
15923 power_tools.gps_provider = _power_test_gps
15924 if request.method == 'POST':
15925 body = request.get_json(silent=True) or {}
15926 result = power_tools.start_test(body.get('duration', 40),
15927 body.get('loads') or [])
15928 return jsonify(result), (200 if result.get('success') else 409)
15929 return jsonify(power_tools.test_status())
15930 except Exception as e:
15931 logger.error(f"Power test error: {e}")
15932 return jsonify({'success': False, 'error': str(e)}), 500
15933
15934
15935@app.route('/api/wardriving/stop', methods=['POST'])
15936def wardriving_stop():
15937 """Stop the current wardriving session.
15938
15939 If the phone-access AP is up (the field 'Exit Wardriving' button on the
15940 minimal mobile page hits this), also tear the AP down so the device returns
15941 to normal Ragnar operation. The teardown is deferred to a background thread
15942 so this HTTP response reaches the AP client *before* the AP radio drops —
15943 otherwise the client's connection dies mid-response and it never learns the
15944 stop succeeded.
15945 """
15946 try:
15947 engine = _get_wardriving_engine()
15948 result = engine.stop()
15949
15950 # Auto-upload of the finished drive is queued by the engine's
15951 # SESSION_FINISHED_HOOKS (covers every stop path, not just this route).
15952
15953 ap_teardown = False

Callers

nothing calls this directly

Calls 7

_get_networks_dirFunction · 0.85
_format_bytes_simpleFunction · 0.85
_format_timestamp_simpleFunction · 0.85
appendMethod · 0.80
errorMethod · 0.80
readMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected