Initial commit
This commit is contained in:
86
archive/old_scripts/diagnostic_whitelist.py
Executable file
86
archive/old_scripts/diagnostic_whitelist.py
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Diagnostic de la liste blanche
|
||||
"""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent / "geniusia2"))
|
||||
|
||||
from core.config import get_config
|
||||
from core.logger import Logger
|
||||
from core.whitelist_manager import WhitelistManager
|
||||
|
||||
def main():
|
||||
print("\n" + "="*60)
|
||||
print(" 🔍 DIAGNOSTIC LISTE BLANCHE")
|
||||
print("="*60 + "\n")
|
||||
|
||||
# Charger la config
|
||||
config = get_config()
|
||||
logger = Logger()
|
||||
|
||||
print("📋 Configuration:")
|
||||
print(f" enforce_whitelist: {config['security'].get('enforce_whitelist')}")
|
||||
print(f" ask_before_new_window: {config['security'].get('ask_before_new_window')}")
|
||||
print()
|
||||
|
||||
# Créer le whitelist manager
|
||||
whitelist_manager = WhitelistManager(logger=logger)
|
||||
|
||||
print("🛡️ Liste Blanche:")
|
||||
whitelist = whitelist_manager.get_whitelist()
|
||||
|
||||
if whitelist:
|
||||
print(f" {len(whitelist)} fenêtre(s) autorisée(s):")
|
||||
for window in whitelist:
|
||||
print(f" - {window}")
|
||||
else:
|
||||
print(" ❌ Liste vide (aucune fenêtre autorisée)")
|
||||
print()
|
||||
|
||||
# Tester quelques fenêtres
|
||||
test_windows = [
|
||||
"Kiro",
|
||||
"Firefox",
|
||||
"Chrome",
|
||||
"Terminal",
|
||||
"Code",
|
||||
"Unknown Window"
|
||||
]
|
||||
|
||||
print("🧪 Test de fenêtres:")
|
||||
for window in test_windows:
|
||||
allowed = whitelist_manager.is_window_allowed(window)
|
||||
status = "✅ Autorisée" if allowed else "❌ Bloquée"
|
||||
print(f" {window:20} : {status}")
|
||||
print()
|
||||
|
||||
print("="*60)
|
||||
print(" 💡 SOLUTION")
|
||||
print("="*60 + "\n")
|
||||
|
||||
if not whitelist:
|
||||
print("La liste blanche est vide !")
|
||||
print()
|
||||
print("Options :")
|
||||
print()
|
||||
print("1️⃣ Mode Permissif (Recommandé pour les tests)")
|
||||
print(" - Dans l'app, le bouton 'Mode: Tout Autoriser' devrait être activé")
|
||||
print(" - Vérifie que enforce_whitelist = False dans la config")
|
||||
print()
|
||||
print("2️⃣ Ajouter des fenêtres à la liste blanche")
|
||||
print(" - Dans l'app, clique sur 'Gérer la Liste Blanche'")
|
||||
print(" - Ajoute 'Kiro', 'Firefox', etc.")
|
||||
print()
|
||||
else:
|
||||
print("La liste blanche contient des fenêtres.")
|
||||
print("Si tu veux observer d'autres fenêtres :")
|
||||
print(" - Ajoute-les via le bouton 'Gérer la Liste Blanche'")
|
||||
print(" - Ou active le 'Mode: Tout Autoriser'")
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user