modification export_matrice_flux, ajout nom SCAN
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Analyse Réseau
|
||||
# SCAN
|
||||
Standardization, Centralization and Analysis of Networks
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
Reference in New Issue
Block a user