ajout doc + correction

This commit is contained in:
Chevallier
2026-06-01 09:51:24 +02:00
parent 2a357d4d90
commit ee160fc06c
17 changed files with 684 additions and 60 deletions

View File

@@ -75,11 +75,12 @@ class ToolTip:
def open_firewall_gui_multi(app, OUTPUT_DIR, HELP_FILE_FW, FIREWALL_DIR, FIREWALL_MAIN):
app2 = tk.Toplevel(app)
app2.title("Analyse Configuration Firewall - Plusieurs firewall")
app2.geometry("800x450")
app2.geometry("800x500")
app2.resizable(True, True)
matrice_flux = tk.BooleanVar()
matrice_routage = tk.BooleanVar()
interfaces = tk.BooleanVar()
content = make_scrollable(app2)
@@ -158,6 +159,8 @@ def open_firewall_gui_multi(app, OUTPUT_DIR, HELP_FILE_FW, FIREWALL_DIR, FIREWAL
cmd.append("-f")
if matrice_routage.get():
cmd.append("-r")
if interfaces.get():
cmd.append("-i")
cmd.append("-o")
if item["type"] == "file":
@@ -376,9 +379,16 @@ def open_firewall_gui_multi(app, OUTPUT_DIR, HELP_FILE_FW, FIREWALL_DIR, FIREWAL
content,
text="Générer la matrice de routage en Excel (route statique uniquement)",
variable=matrice_routage
).pack(anchor="w", padx=10, pady=(0, 10))
).pack(anchor="w", padx=10, pady=(0, 0))
matrice_routage.set(True)
ttk.Checkbutton(
content,
text="Générer la configuration des interfaces en Excel",
variable=interfaces
).pack(anchor="w", padx=10, pady=(0, 10))
interfaces.set(True)
ttk.Label(
content,
text="Dossier de sortie :",
@@ -418,7 +428,7 @@ def open_firewall_gui(root, BASE_DIR):
app = tk.Toplevel(root)
app.title("Analyse Configuration Firewall")
app.geometry("800x450")
app.geometry("800x500")
app.resizable(True, True)
firewall_var = tk.StringVar()
@@ -427,6 +437,7 @@ def open_firewall_gui(root, BASE_DIR):
matrice_flux = tk.BooleanVar()
matrice_routage = tk.BooleanVar()
interfaces = tk.BooleanVar()
def browse_input():
fw_type = firewall_var.get()
@@ -453,22 +464,15 @@ def open_firewall_gui(root, BASE_DIR):
f_json = os.path.join(OUTPUT_DIR, f"{fw}_{output_var.get()}.json")
f_flux = os.path.join(OUTPUT_DIR, f"matrice_flux_{fw}_{output_var.get()}.xlsx")
f_routage = os.path.join(OUTPUT_DIR, f"matrice_routage_{fw}_{output_var.get()}.xlsx")
f_interfaces = os.path.join(OUTPUT_DIR, f"interfaces_{fw}_{output_var.get()}.xlsx")
else:
dt = datetime.now().strftime("%Y%m%d")
f_json = os.path.join(OUTPUT_DIR, f"{fw}_{dt}.json")
f_flux = os.path.join(OUTPUT_DIR, f"matrice_flux_{fw}_{dt}.xlsx")
f_routage = os.path.join(OUTPUT_DIR, f"matrice_routage_{fw}_{dt}.xlsx")
f_interfaces = os.path.join(OUTPUT_DIR, f"interfaces_{fw}_{dt}.xlsx")
if not matrice_flux.get():
if not matrice_routage.get():
output_label_var.set("Fichier de sortie :\n" + f_json)
else:
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_routage)
else:
if not matrice_routage.get():
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_flux)
else:
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_flux + "\n" + f_routage)
output_label_var.set("Fichier de sortie :\n" + f_json + ("\n" + f_flux if matrice_flux.get() else "") + ("\n" + f_routage if matrice_routage.get() else "") + ("\n" + f_interfaces if interfaces.get() else ""))
app.update_idletasks()
def open_output_folder():
@@ -518,9 +522,10 @@ def open_firewall_gui(root, BASE_DIR):
if matrice_flux.get():
cmd.append("-f")
if matrice_routage.get():
cmd.append("-r")
if interfaces.get():
cmd.append("-i")
print("Commande exécutée :", " ".join(cmd))
print("Dossier courant (cwd) :", FIREWALL_DIR)
@@ -636,15 +641,23 @@ def open_firewall_gui(root, BASE_DIR):
app,
text="Générer la matrice de routage en Excel (route statique uniquement)",
variable=matrice_routage
).pack(anchor="w", padx=10, pady=(0, 10))
).pack(anchor="w", padx=10, pady=(0, 0))
matrice_routage.set(True)
ttk.Checkbutton(
app,
text="Générer la configuration des interfaces en Excel",
variable=interfaces
).pack(anchor="w", padx=10, pady=(0, 10))
interfaces.set(True)
output_label_var = tk.StringVar()
ttk.Label(app, textvariable=output_label_var).pack(anchor="w", padx=10)
firewall_var.trace_add("write", update_output_label)
output_var.trace_add("write", update_output_label)
matrice_flux.trace_add("write", update_output_label)
matrice_routage.trace_add("write", update_output_label)
interfaces.trace_add("write", update_output_label)
update_output_label()
ttk.Button(