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

Method tg_send_code

IntelOSINT.py:13662–13684  ·  view source on GitHub ↗
(self, api_id, api_hash, phone)

Source from the content-addressed store, hash-verified

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
13664 try:
13665 api_id = str(api_id or "").strip()
13666 api_hash = str(api_hash or "").strip()
13667 phone = str(phone or "").strip()
13668 if not api_id or not api_hash or not phone:
13669 return "error", "Inserisci Telegram API ID, API HASH e numero di telefono."
13670 client = TelegramClient(StringSession(), int(api_id), api_hash, loop=get_telethon_loop())
13671 await client.connect()
13672 if not await client.is_user_authorized():
13673 temp_phone_hash = await client.send_code_request(phone)
13674 temp_tg_client = client
13675 self.creds['tg_id'] = api_id
13676 self.creds['tg_hash'] = api_hash
13677 self.creds['my_phone'] = phone
13678 self.save_creds(self.creds)
13679 return "ok", "Codice OTP inviato"
13680 else:
13681 _store_tg_session(client.session.save()); self.creds.pop("tg_session", None); self.save_creds(self.creds); await client.disconnect(); return "authorized", "Gia autenticato"
13682 except Exception as e:
13683 print(f"[!] Telegram OTP send failed: {type(e).__name__}")
13684 return "error", "Invio OTP non riuscito. Verifica API ID, API HASH e telefono."
13685
13686 async def tg_verify_code(self, code, phone):
13687 global temp_tg_client, temp_phone_hash

Callers 1

tg_sendFunction · 0.80

Calls 3

save_credsMethod · 0.95
get_telethon_loopFunction · 0.85
_store_tg_sessionFunction · 0.85

Tested by

no test coverage detected