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

Function export_netkb_data

webapp_modern.py:18919–19005  ·  view source on GitHub ↗

Export NetKB data in various formats

()

Source from the content-addressed store, hash-verified

18917
18918
18919@socketio.on('disconnect', namespace='/terminal')
18920def term_disconnect():
18921 _term_cleanup(request.sid)
18922 logger.info(f"Web terminal closed (sid={request.sid})")
18923
18924
18925@socketio.on('connect')
18926def handle_connect():
18927 """Handle client connection - reject if auth is configured but not authenticated"""
18928 if auth_mgr.is_configured() and not session.get('authenticated'):
18929 logger.warning("Rejected unauthenticated WebSocket connection")
18930 disconnect()
18931 return False
18932
18933 global clients_connected
18934 clients_connected += 1
18935 logger.info(f"Client connected. Total clients: {clients_connected}")
18936 emit('connected', {
18937 'message': 'Connected to Ragnar',
18938 'auth_configured': auth_mgr.is_configured()
18939 })
18940
18941 # Send initial data to new client
18942 try:
18943 ensure_recent_sync()
18944 status_data = get_current_status()
18945 emit('status_update', status_data)
18946
18947 # Send recent logs
18948 logs = get_recent_logs()
18949 emit('log_update', logs)
18950 except Exception as e:
18951 logger.error(f"Error sending initial data: {e}")
18952
18953
18954@socketio.on('disconnect')
18955def handle_disconnect():
18956 """Handle client disconnection"""
18957 global clients_connected
18958 clients_connected = max(0, clients_connected - 1)
18959 logger.info(f"Client disconnected. Total clients: {clients_connected}")
18960
18961
18962@socketio.on('request_status')
18963def handle_status_request():
18964 """Handle status update request"""
18965 try:
18966 status_data = get_current_status()
18967 emit('status_update', status_data)
18968 except Exception as e:
18969 logger.error(f"Error handling status request: {e}")
18970
18971
18972@socketio.on('request_logs')
18973def handle_log_request():
18974 """Handle request for recent logs"""
18975 try:
18976 logs = get_recent_logs()

Callers

nothing calls this directly

Calls 5

appendMethod · 0.80
seekMethod · 0.80
errorMethod · 0.80
getMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected