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

Function get_zap_logs

webapp_modern.py:17888–17941  ·  view source on GitHub ↗

Get ZAP-related log entries from the advanced_vuln_scanner log file. Filters for [ZAP-START], [ZAP-CLEANUP] and other ZAP-related lines to help diagnose startup/crash issues. Query params: lines: max lines to return (default 200) filter: additional keyword filt

()

Source from the content-addressed store, hash-verified

17886 logger.info(f"Serving network data for WiFi: {current_ssid} with {len(network_data)} entries")
17887 return html
17888
17889 except Exception as e:
17890 logger.error(f"Error serving network data: {e}")
17891 current_ssid = get_current_wifi_ssid()
17892 return f'<div class="error">Error loading network data for WiFi: {current_ssid}<br>Error: {str(e)}</div>'
17893
17894@app.route('/list_credentials')
17895def legacy_credentials():
17896 """Legacy endpoint for credentials"""
17897 return get_credentials()
17898
17899@app.route('/get_logs')
17900def legacy_logs():
17901 """Legacy endpoint for logs"""
17902 return get_logs()
17903
17904@app.route('/netkb_data_json')
17905def legacy_netkb_json():
17906 """Legacy endpoint for network knowledge base JSON - now uses SQLite database"""
17907 try:
17908 # Get alive hosts from database
17909 hosts = shared_data.db.get_all_hosts()
17910 alive_hosts = [h for h in hosts if h.get('status') == 'alive']
17911
17912 # Get available actions from actions file
17913 actions = []
17914 try:
17915 with open(shared_data.actions_file, 'r') as f:
17916 actions_config = json.load(f)
17917 actions = list(actions_config.keys())
17918 except Exception:
17919 pass
17920
17921 # Build ports dict (ip -> list of ports)
17922 ports_dict = {}
17923 for host in alive_hosts:
17924 ip = host.get('ip', '')
17925 if ip:
17926 port_str = host.get('ports', '')
17927 ports_dict[ip] = port_str.split(',') if port_str else []
17928
17929 response_data = {
17930 'ips': [h.get('ip', '') for h in alive_hosts if h.get('ip')],
17931 'ports': ports_dict,
17932 'actions': actions
17933 }
17934
17935 return jsonify(response_data)
17936 except Exception as e:
17937 logger.error(f"Error getting netkb JSON: {e}")
17938 return jsonify({'error': str(e)}), 500
17939
17940
17941# ============================================================================
17942# WEBSOCKET EVENTS
17943# ============================================================================
17944

Callers

nothing calls this directly

Calls 4

_safe_intFunction · 0.85
appendMethod · 0.80
errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected