- Correction des 907 erreurs ruff (pathlib, imports, nommage, simplifications, docstrings) - Fix déduplication labels dans multiselect nœuds d'arrivée (analyse) - Expansion 1→N label→IDs pour le Sankey (Pays d'opération) - Ajout CLAUDE.md et document de design de l'audit - Mise à jour .gitignore (artefacts tests exploratoires) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Script pour générer un rapport factorisé des vulnérabilités critiques
|
|
suivant la structure définie dans Remarques.md.
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import streamlit as st
|
|
|
|
from utils.config import TEMP_SECTIONS, TEMPLATE_PATH, load_config, session_uuid
|
|
from utils.files import write_report
|
|
from utils.graphs import calculate_vulnerabilities, extract_data_from_graph, parse_graphs
|
|
from utils.ia import generer_rapport_final, ia_analyse, ingest_document, supprimer_fichiers
|
|
from utils.sections import generate_report
|
|
from utils.sections_utils import nettoyer_texte_fr
|
|
|
|
|
|
def main(dot_path, output_path):
|
|
"""Fonction principale du script."""
|
|
# Charger la configuration
|
|
config = load_config()
|
|
|
|
# Analyser les graphes
|
|
graph, ref_graph = parse_graphs(dot_path)
|
|
# Extraire les données
|
|
data = extract_data_from_graph(graph, ref_graph)
|
|
# Calculer les vulnérabilités
|
|
results = calculate_vulnerabilities(data, config)
|
|
if "step" not in st.session_state:
|
|
st.session_state["step"] = 1
|
|
# Générer le rapport
|
|
report, file_names = generate_report(data, results, config)
|
|
# Écrire le rapport
|
|
write_report(report, TEMPLATE_PATH)
|
|
ingest_document(TEMPLATE_PATH)
|
|
# Générer l'analyse par l'IA du rapport complet
|
|
analyse_finale = nettoyer_texte_fr(ia_analyse(file_names))
|
|
analyse_fichier = TEMP_SECTIONS / TEMPLATE_PATH.name.replace(".md", " - analyse.md")
|
|
write_report(analyse_finale, analyse_fichier)
|
|
|
|
if generer_rapport_final(TEMPLATE_PATH, analyse_fichier, output_path):
|
|
supprimer_fichiers(session_uuid)
|
|
|
|
if __name__ == "__main__":
|
|
dot_path = Path(sys.argv[1])
|
|
output_path = Path(sys.argv[2])
|
|
main(dot_path, output_path)
|