From 68a22beb69950779e5f8c146941b3707d868b02f Mon Sep 17 00:00:00 2001 From: Chevallier Date: Tue, 2 Jun 2026 15:30:59 +0200 Subject: [PATCH] modification export_matrice_flux, ajout nom SCAN --- .../src/scripts/export_matrice_flux.py | 6 ++++-- .../src/scripts/style_excel/style_matrice_flux.py | 15 ++++++++++----- README.md | 3 ++- main.py | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Parseurs_config_Firewall/src/scripts/export_matrice_flux.py b/Parseurs_config_Firewall/src/scripts/export_matrice_flux.py index 8097aa5..fc79a04 100644 --- a/Parseurs_config_Firewall/src/scripts/export_matrice_flux.py +++ b/Parseurs_config_Firewall/src/scripts/export_matrice_flux.py @@ -158,11 +158,9 @@ def export_to_excel(json_file_path, output_file_excel): "Description": acl_desc, "Src Equipement": ", ".join(src_e), "Src CIDR": src_c, - "Src VLAN":"", "Src Site": src_sites, "Dst Equipement": ", ".join(dst_e), "Dst CIDR": dst_c, - "Dst VLAN":"", "Dst Site": dst_sites, "Application": cfg.get("description",""), "Port": transport.get("destination-port",""), @@ -173,6 +171,10 @@ def export_to_excel(json_file_path, output_file_excel): }) df = pd.DataFrame(rows) + tier_is_empty = df["Tier"].replace("", pd.NA).isna().all() + if tier_is_empty: + df = df.drop(columns=["Tier"]) + df_addr = pd.DataFrame([ { "Group Name": g, diff --git a/Parseurs_config_Firewall/src/scripts/style_excel/style_matrice_flux.py b/Parseurs_config_Firewall/src/scripts/style_excel/style_matrice_flux.py index a6a6821..26f4f99 100644 --- a/Parseurs_config_Firewall/src/scripts/style_excel/style_matrice_flux.py +++ b/Parseurs_config_Firewall/src/scripts/style_excel/style_matrice_flux.py @@ -20,9 +20,14 @@ def format_cell_multiline(value): return val.replace(", ", "\n").replace(";", "\n").replace(",", "\n").replace(";", "\n") def style_matrice_flux(ws): + header_values = [cell.value for cell in ws[2]] + has_tier = "Tier" in header_values + headers = [ - ("Description",2),("Source",4),("Destination",4), - ("Application",1),("Port",1),("Miscellaneous",1),("Action",1),("Tier",1),("Active",1) + ("Description", 2), ("Source", 3), ("Destination", 3), + ("Application", 1), ("Port", 1), ("Miscellaneous", 1), ("Action", 1), + *([("Tier", 1)] if has_tier else []), + ("Active", 1) ] col = 1 @@ -57,9 +62,9 @@ def style_matrice_flux(ws): cell.border = thin_border col_widths = { - "A": 50, "B": 35, "C": 35, "D": 18, "E": 15, "F": 15, - "G": 35, "H": 18, "I": 15, "J": 15, "K": 12, "L": 20, - "M": 25, "N": 9, "O": 7, "P": 7 + "A": 50, "B": 35, "C": 35, "D": 18, "E": 15, + "F": 35, "G": 18, "H": 15, "I": 12, "J": 20, + "K": 25, "L": 9, "M": 7, "N": 7 } for col_letter, width in col_widths.items(): ws.column_dimensions[col_letter].width = width diff --git a/README.md b/README.md index 1f6ad73..97da12b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Analyse Réseau +# SCAN +Standardization, Centralization and Analysis of Networks ## Description diff --git a/main.py b/main.py index 640a5d6..29b470c 100644 --- a/main.py +++ b/main.py @@ -68,7 +68,7 @@ def relaunch_in_venv(): # Contenu fenêtre principale def open_main_gui(): root = tk.Tk() - root.title("Analyse Réseau") + root.title("SCAN") root.geometry("650x500") root.resizable(True, True)