@@ -534,8 +534,7 @@ def _esc(s: str) -> str:
534534def check_dipendenze () -> dict :
535535 """
536536 Controlla la disponibilita degli strumenti necessari.
537- Restituisce {nome: True/False} per gli strumenti obbligatori,
538- e raggruppa quelli opzionali (terminali, client RDP/VNC).
537+ Restituisce {nome: True/False} per tutti gli strumenti.
539538 """
540539 # Strumenti obbligatori / fortemente consigliati
541540 tools = {
@@ -572,6 +571,80 @@ def check_dipendenze() -> dict:
572571 return tools
573572
574573
574+ def check_dipendenze_categorizzate () -> dict :
575+ """
576+ Controlla le dipendenze categorizzandole per importanza.
577+ Restituisce un dizionario con le categorie:
578+ - 'core': dipendenze essenziali per il funzionamento base
579+ - 'recommended': dipendenze fortemente consigliate
580+ - 'optional': dipendenze opzionali per funzionalità specifiche
581+ - 'missing_core': lista delle dipendenze core mancanti
582+ - 'missing_recommended': lista delle dipendenze consigliate mancanti
583+ """
584+ # Dipendenze core (essenziali)
585+ core_deps = {
586+ "ssh" : shutil .which ("ssh" ) is not None ,
587+ "paramiko" : True ,
588+ "cryptography" : True
589+ }
590+
591+ # Verifica librerie Python
592+ try :
593+ import paramiko
594+ core_deps ["paramiko" ] = True
595+ except ImportError :
596+ core_deps ["paramiko" ] = False
597+
598+ try :
599+ import cryptography
600+ core_deps ["cryptography" ] = True
601+ except ImportError :
602+ core_deps ["cryptography" ] = False
603+
604+ # Dipendenze fortemente consigliate
605+ recommended_deps = {
606+ "xdotool" : shutil .which ("xdotool" ) is not None ,
607+ "terminal" : False # Almeno un terminale grafico
608+ }
609+
610+ # Controlla se c'è almeno un terminale disponibile
611+ _terminali = ["xterm" , "xfce4-terminal" , "gnome-terminal" , "konsole" ,
612+ "alacritty" , "kitty" , "terminator" , "wezterm" ,
613+ "foot" , "tilix" , "lxterminal" , "mate-terminal" , "st" ]
614+ recommended_deps ["terminal" ] = any (shutil .which (t ) for t in _terminali )
615+
616+ # Dipendenze opzionali (per protocolli specifici)
617+ optional_deps = {
618+ "sshpass" : shutil .which ("sshpass" ) is not None ,
619+ "xwininfo" : shutil .which ("xwininfo" ) is not None ,
620+ "mosh" : shutil .which ("mosh" ) is not None ,
621+ "telnet" : shutil .which ("telnet" ) is not None ,
622+ "picocom" : shutil .which ("picocom" ) is not None ,
623+ "rdp_client" : False , # Almeno un client RDP
624+ "vnc_client" : False # Almeno un client VNC
625+ }
626+
627+ # Controlla client RDP
628+ rdp_clients = ["xfreerdp3" , "xfreerdp" , "rdesktop" ]
629+ optional_deps ["rdp_client" ] = any (shutil .which (c ) for c in rdp_clients )
630+
631+ # Controlla client VNC
632+ vnc_clients = ["vncviewer" , "realvnc-viewer" , "tigervnc" , "remmina" , "krdc" ]
633+ optional_deps ["vnc_client" ] = any (shutil .which (c ) for c in vnc_clients )
634+
635+ # Calcola dipendenze mancanti
636+ missing_core = [k for k , v in core_deps .items () if not v ]
637+ missing_recommended = [k for k , v in recommended_deps .items () if not v ]
638+
639+ return {
640+ "core" : core_deps ,
641+ "recommended" : recommended_deps ,
642+ "optional" : optional_deps ,
643+ "missing_core" : missing_core ,
644+ "missing_recommended" : missing_recommended
645+ }
646+
647+
575648def installed_tools (category : str ) -> list [str ]:
576649 """
577650 Restituisce la lista degli strumenti installati per categoria.
0 commit comments