(self)
| 13493 | } |
| 13494 | |
| 13495 | def ghunt_login_launch(self): |
| 13496 | script_dir = Path(__file__).resolve().parent |
| 13497 | ghunt_cmd, ghunt_cwd = self._resolve_ghunt_command() |
| 13498 | local_py = (script_dir / "GHunt" / "main.py") |
| 13499 | if not ghunt_cmd and local_py.exists(): |
| 13500 | ghunt_cmd = [str(sys.executable), str(local_py)] |
| 13501 | ghunt_cwd = str(script_dir / "GHunt") |
| 13502 | |
| 13503 | if not ghunt_cmd: |
| 13504 | install_result = self._install_ghunt_runtime() |
| 13505 | if install_result.get("ok"): |
| 13506 | ghunt_cmd, ghunt_cwd = self._resolve_ghunt_command() |
| 13507 | if not ghunt_cmd: |
| 13508 | return {"status": "error", "message": "Installazione eseguita, ma ghunt non ancora in PATH. Riavvia l'app o usa il clone GHunt."} |
| 13509 | else: |
| 13510 | return { |
| 13511 | "status": "error", |
| 13512 | "message": install_result.get( |
| 13513 | "message", |
| 13514 | "ghunt non trovato." |
| 13515 | ) + " Esegui da terminale: pip install ghunt, poi riprova con AVVIA GHUNT LOGIN. " |
| 13516 | "In alternativa setta INTELOSINT_AUTO_INSTALL_GHUNT=0 e usa il clone GHunt." |
| 13517 | } |
| 13518 | |
| 13519 | try: |
| 13520 | self._ensure_ghunt_deps() |
| 13521 | |
| 13522 | run_dir = Path(ghunt_cwd) if ghunt_cwd else script_dir |
| 13523 | run_env = os.environ.copy() |
| 13524 | run_env["PYTHONIOENCODING"] = "utf-8" |
| 13525 | run_env["PYTHONUTF8"] = "1" |
| 13526 | run_env["LC_ALL"] = "C.UTF-8" |
| 13527 | run_env["LANG"] = "C.UTF-8" |
| 13528 | |
| 13529 | listener = script_dir / "ghunt_companion_listener.py" |
| 13530 | if os.name == "nt" and listener.exists(): |
| 13531 | subprocess.Popen( |
| 13532 | [str(sys.executable), str(listener)], |
| 13533 | cwd=str(script_dir), |
| 13534 | env=run_env, |
| 13535 | creationflags=subprocess.CREATE_NEW_CONSOLE, |
| 13536 | ) |
| 13537 | |
| 13538 | launch_info = self._run_ghunt_login_command(ghunt_cmd, run_dir, run_env) |
| 13539 | return { |
| 13540 | "status": "ok", |
| 13541 | "message": "Finestra GHunt avviata: verifica la finestra del terminale per completare il login con GHunt Companion.", |
| 13542 | "launch": launch_info |
| 13543 | } |
| 13544 | except Exception as e: |
| 13545 | return {"status": "error", "message": f"Errore avvio GHunt login: {e}"} |
| 13546 | |
| 13547 | def ghunt_smart_start(self): |
| 13548 | script_dir = Path(__file__).resolve().parent |
no test coverage detected