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

Function reset_vulnerabilities

webapp_modern.py:10981–11061  ·  view source on GitHub ↗

Reset all vulnerability data - removes all discovered vulnerabilities IMPORTANT: Network Intelligence is the SINGLE SOURCE OF TRUTH for vulnerabilities. - Vulnerabilities are cleared from Network Intelligence (in-memory + JSON files) - Legacy CSV files are also cleared for back

()

Source from the content-addressed store, hash-verified

10979 offset = _safe_int(request.args.get('offset'), 0, min_v=0)
10980 sort_by = request.args.get('sort', 'best_rssi')
10981 order = request.args.get('order', 'DESC')
10982
10983 if session_id and (not engine.session or engine.session.session_id != session_id):
10984 # Load a past session
10985 from wardriving import WardrivingSession
10986 session = WardrivingSession(engine.data_dir, session_id=session_id)
10987 elif engine.session:
10988 session = engine.session
10989 else:
10990 return jsonify({'networks': [], 'total': 0})
10991
10992 networks = session.get_networks(limit=limit, offset=offset, sort_by=sort_by, order=order)
10993 stats = session.get_stats()
10994 return jsonify({
10995 'networks': networks,
10996 'total': stats.get('total_networks', 0),
10997 'session_id': session.session_id
10998 })
10999 except Exception as e:
11000 logger.error(f"Wardriving networks error: {e}")
11001 return jsonify({'error': str(e)}), 500
11002
11003@app.route('/api/wardriving/sessions')
11004def wardriving_sessions():
11005 """List all wardriving sessions."""
11006 try:
11007 engine = _get_wardriving_engine()
11008 sessions = engine.get_session_list()
11009 return jsonify({'sessions': sessions})
11010 except Exception as e:
11011 logger.error(f"Wardriving sessions error: {e}")
11012 return jsonify({'error': str(e)}), 500
11013
11014@app.route('/api/wardriving/export/<session_id>')
11015def wardriving_export(session_id):
11016 """Export a wardriving session as WiGLE CSV or KML."""
11017 try:
11018 # Validate session_id to prevent path traversal
11019 if not re.match(r'^[A-Za-z0-9_-]+$', session_id):
11020 return jsonify({'error': 'Invalid session ID'}), 400
11021
11022 fmt = request.args.get('format', 'wigle')
11023 engine = _get_wardriving_engine()
11024
11025 from wardriving import WardrivingSession
11026 session = WardrivingSession(engine.data_dir, session_id=session_id)
11027
11028 if fmt == 'kml':
11029 content = session.export_kml()
11030 return app.response_class(
11031 content, mimetype='application/vnd.google-earth.kml+xml',
11032 headers={'Content-Disposition': f'attachment; filename=ragnar_wardriving_{session_id}.kml'}
11033 )
11034 elif fmt == 'report':
11035 device_name = engine.device_name or shared_data.config.get('wardriving_device_name', 'Ragnar')
11036 content = session.export_report_html(device_name=device_name)
11037 # Rendered inline so the browser can print/save-as-PDF; not a forced
11038 # download, since the survey report is meant to be viewed first.

Callers

nothing calls this directly

Calls 7

sync_vulnerability_countFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80
debugMethod · 0.80
valuesMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected