Advertisement
disk6969

Telethon 1-1 calls

Nov 30th, 2023 (edited)
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. import hashlib
  2. import os
  3. from telethon.tl.functions.messages import GetDhConfigRequest
  4. from telethon.tl.functions.phone import RequestCallRequest
  5. from telethon.tl.types import PhoneCallProtocol
  6.  
  7. def get_a(config):
  8.     rand, a = bytes(x ^ y for x, y in zip(os.urandom(256), config.random)), 0
  9.     while not (1 < a < config.p - 1): a = int.from_bytes(rand, 'little')
  10.     return a
  11.  
  12. async def call_user(user_id):
  13.     config = await client(GetDhConfigRequest(0, 256))
  14.     config.p = int.from_bytes(config.p)
  15.     a = get_a(config)
  16.     g_a = pow(config.g, a, config.p)
  17.     g_a_hash = hashlib.sha256(int.to_bytes(g_a, 256)).digest()
  18.     protocol = PhoneCallProtocol(min_layer=65, max_layer=93, udp_p2p=True, library_versions={})
  19.     return await client(RequestCallRequest(user_id, g_a_hash=g_a_hash, protocol=protocol))
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement