MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / ghunt_login_method2

Method ghunt_login_method2

IntelOSINT.py:13619–13660  ·  view source on GitHub ↗
(self, cookie_code)

Source from the content-addressed store, hash-verified

13617 return {"status": "error", "message": "Impossibile leggere la sessione GHunt. Ripeti il login."}
13618
13619 def ghunt_login_method2(self, cookie_code):
13620 code = (cookie_code or "").strip()
13621 if not code:
13622 return {"status": "error", "message": "Codice Metodo 2 mancante."}
13623 self._ensure_ghunt_deps()
13624 ghunt_cmd, ghunt_cwd = self._resolve_ghunt_command()
13625 local_py = (Path(__file__).resolve().parent / "GHunt" / "main.py")
13626 if not ghunt_cmd and local_py.exists():
13627 ghunt_cmd = [str(sys.executable), str(local_py)]
13628 ghunt_cwd = str(local_py.parent)
13629 if not ghunt_cmd:
13630 install_result = self._install_ghunt_runtime()
13631 if install_result.get("ok"):
13632 ghunt_cmd, ghunt_cwd = self._resolve_ghunt_command()
13633 if not ghunt_cmd:
13634 return {"status": "error", "message": "Installa GHunt manualmente: `pip install ghunt`."}
13635 else:
13636 return {"status": "error", "message": "ghunt non trovato. Usa `pip install ghunt` prima."}
13637
13638 try:
13639 run_env = os.environ.copy()
13640 run_env["PYTHONIOENCODING"] = "utf-8"
13641 run_env["PYTHONUTF8"] = "1"
13642 # Login non-interattivo: scelta metodo 2 + codice base64
13643 payload = f"2{os.linesep}{code}{os.linesep}"
13644 proc = subprocess.run(
13645 ghunt_cmd + ["login"],
13646 input=payload,
13647 capture_output=True,
13648 text=True,
13649 timeout=120,
13650 cwd=str(ghunt_cwd),
13651 env=run_env
13652 )
13653 st = self.ghunt_login_status()
13654 if st.get("status") == "authenticated":
13655 return {"status": "ok", "message": "Autenticazione GHunt completata con Metodo 2."}
13656 return {"status": "partial", "message": "Login inviato, ma sessione non valida. Verifica codice/estensione."}
13657 except subprocess.TimeoutExpired:
13658 return {"status": "error", "message": "Timeout GHunt login Metodo 2. Riprova."}
13659 except Exception:
13660 return {"status": "error", "message": "Errore Metodo 2. Riprova senza esporre il codice nel log."}
13661 # --- TELEGRAM ---
13662 async def tg_send_code(self, api_id, api_hash, phone):
13663 global temp_tg_client, temp_phone_hash

Callers 1

ghunt_login_method2Function · 0.80

Calls 4

_ensure_ghunt_depsMethod · 0.95
ghunt_login_statusMethod · 0.95

Tested by

no test coverage detected