mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-03-27 13:24:14 +03:00
Fix alternative connection modes
This commit is contained in:
parent
ebde3be820
commit
a5d4e97922
|
@ -11,7 +11,8 @@ class ConnectionTcpAbridged(Connection):
|
|||
"""
|
||||
async def connect(self, timeout=None, ssl=None):
|
||||
await super().connect(timeout=timeout, ssl=ssl)
|
||||
await self.send(b'\xef')
|
||||
self._writer.write(b'\xef')
|
||||
await self._writer.drain()
|
||||
|
||||
def _write(self, data):
|
||||
"""
|
||||
|
|
|
@ -10,7 +10,8 @@ class ConnectionTcpIntermediate(Connection):
|
|||
"""
|
||||
async def connect(self, timeout=None, ssl=None):
|
||||
await super().connect(timeout=timeout, ssl=ssl)
|
||||
await self.send(b'\xee\xee\xee\xee')
|
||||
self._writer.write(b'\xee\xee\xee\xee')
|
||||
await self._writer.drain()
|
||||
|
||||
def _send(self, data):
|
||||
self._writer.write(struct.pack('<i', len(data)) + data)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
|
||||
from .connection import Connection
|
||||
from .tcpabridged import ConnectionTcpAbridged
|
||||
from ...crypto import AESModeCTR
|
||||
|
||||
|
@ -48,4 +47,5 @@ class ConnectionTcpObfuscated(ConnectionTcpAbridged):
|
|||
self._aes_decrypt = AESModeCTR(decrypt_key, decrypt_iv)
|
||||
|
||||
random[56:64] = self._aes_encrypt.encrypt(bytes(random))[56:64]
|
||||
await self._send(random)
|
||||
self._writer.write(random)
|
||||
await self._writer.drain()
|
||||
|
|
Loading…
Reference in New Issue
Block a user