From 61ec8b669b667f2682781512a8020d39410d150f Mon Sep 17 00:00:00 2001 From: Blackwhitebear8 Date: Sun, 12 Jan 2025 17:35:44 +0100 Subject: [PATCH] Update arp.py --- arp.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arp.py b/arp.py index 9cd951e..e9fa5a6 100644 --- a/arp.py +++ b/arp.py @@ -5,7 +5,6 @@ from flask import Flask, render_template_string, jsonify app = Flask(__name__) -# Functie om de cURL-oproep te doen voor de ARP-tabel def run_curl_command(): curl_command = [ "curl", "-k", "--location", "--request", "POST", "https://ip:port/show", @@ -15,16 +14,14 @@ def run_curl_command(): response = subprocess.check_output(curl_command, text=True) return json.loads(response) -# Functie om de ARP-gegevens te verwerken def parse_arp_data(data): arp_table = [] if "data" in data: raw_data = data["data"] - # Verwerk de gegevens per regel for line in raw_data.split("\n"): - if line.strip() and not line.startswith("Address"): + if line.strip() and not line.startswith("Address") and "---" not in line: arp_info = line.split() if len(arp_info) >= 4: arp_table.append({ @@ -36,7 +33,6 @@ def parse_arp_data(data): return arp_table -# Functie om de ARP-tabel in HTML te genereren def generate_html_table(arp_table): html_template = """ @@ -140,7 +136,6 @@ def generate_html_table(arp_table): return html_output -# Route om de ARP-tabel weer te geven als HTML @app.route('/') def arp_table_summary(): data = run_curl_command() @@ -151,7 +146,6 @@ def arp_table_summary(): return render_template_string(html_output) -# Route om de ARP-tabel als JSON weer te geven @app.route('/json') def arp_table_summary_json(): data = run_curl_command()