From 9e65fbf94e3f5d1ed1be1085951c9367735acbe2 Mon Sep 17 00:00:00 2001 From: Blackwhitebear8 Date: Wed, 17 Sep 2025 20:29:14 +0200 Subject: [PATCH] Update app.py --- app.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index be9e0dd..d5dd9fa 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ from datetime import datetime, timedelta app = Flask(__name__) -from modules.parse import run_bgp_curl_command, run_arp_curl_command, run_neighbors_curl_command, run_interfaces_curl_command, run_bgp_route_curl_command, run_rpki_cache_connection_curl_command, run_rpki_lookup_curl_command, run_bgp_neighbor_detail_curl_command, run_bfd_peers_curl_command, run_bfd_peer_detail_curl_command, run_bgp_dampeningv4_curl_command, run_bgp_dampeningv6_curl_command,run_firewall_ipv4_curl_command, run_firewall_ipv6_curl_command, run_bgp_reset_command, run_bgp_shutdown_command, run_bgp_enable_command +from modules.parse import run_bgp_curl_command, run_arp_curl_command, run_neighbors_curl_command, run_interfaces_curl_command, run_bgp_route_curl_command, run_rpki_cache_connection_curl_command, run_rpki_lookup_curl_command, run_bgp_neighbor_detail_curl_command, run_bfd_peers_curl_command, run_bfd_peer_detail_curl_command, run_bgp_dampeningv4_curl_command, run_bgp_dampeningv6_curl_command,run_firewall_ipv4_curl_command, run_firewall_ipv6_curl_command, run_bgp_reset_command, run_bgp_shutdown_command, run_bgp_enable_command, run_firewall_log_curl_command from modules.bgp import parse_bgp_data, generate_bgp_json from modules.arp import parse_arp_data, generate_arp_json from modules.neighbors import parse_neighbors_data, generate_neighbors_json @@ -19,7 +19,7 @@ from modules.librenms import get_port_id, fetch_graph_base64 from modules.rpki import parse_rpki_cache_data, parse_rpki_lookup_data from modules.bfd import parse_bfd_peers_data from modules.bgp_dampening import parse_dampened_data, generate_dampened_json -from modules.firewall import parse_firewall_data +from modules.firewall import parse_firewall_data, parse_firewall_log_data from modules.visual_route import generate_visual_route_graph from modules.database import get_peer_history, get_total_routes_history, get_unique_peers @@ -314,6 +314,20 @@ def firewall_json(): except Exception as e: return jsonify({"error": "Failed to retrieve firewall data.", "details": str(e)}), 500 +@app.route('/firewall/log///') +def firewall_log_page(ip_version, ruleset_name, rule_number): + try: + raw_data = run_firewall_log_curl_command(ip_version, ruleset_name, rule_number) + log_data = parse_firewall_log_data(raw_data) + except Exception as e: + log_data = f"Could not retrieve the logs: {e}" + + return render_template('firewall_log.html', + ip_version=ip_version, + ruleset_name=ruleset_name, + rule_number=rule_number, + log_data=log_data) + @app.route('/bgp/peer///graph') def bgp_peer_graph_page(ip_version, neighbor_ip): if ip_version not in ['ipv4', 'ipv6']: