mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-03 07:30:38 +00:00
Refactored imports
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
from .mtproto_plain_sender import MtProtoPlainSender
|
||||
from .tcp_client import TcpClient
|
||||
from .tcp_message import TcpMessage
|
||||
from .authenticator import do_authentication
|
||||
from .mtproto_sender import MtProtoSender
|
||||
from .tcp_transport import TcpTransport
|
||||
|
||||
@@ -5,15 +5,10 @@
|
||||
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Auth/Step3_CompleteDHExchange.cs
|
||||
|
||||
import time
|
||||
|
||||
import utils.helpers as utils
|
||||
from crypto.aes import AES
|
||||
from crypto.auth_key import AuthKey
|
||||
from crypto.factorizator import Factorizator
|
||||
from crypto.rsa import RSA
|
||||
from network.mtproto_plain_sender import MtProtoPlainSender
|
||||
from utils.binary_reader import BinaryReader
|
||||
from utils.binary_writer import BinaryWriter
|
||||
import utils
|
||||
from utils import BinaryWriter, BinaryReader
|
||||
from crypto import AES, AuthKey, Factorizator, RSA
|
||||
from network import MtProtoPlainSender
|
||||
|
||||
|
||||
def do_authentication(transport):
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# This file is based on TLSharp
|
||||
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Network/MtProtoPlainSender.cs
|
||||
import time
|
||||
from utils.binary_writer import BinaryWriter
|
||||
from utils.binary_reader import BinaryReader
|
||||
from utils import BinaryWriter, BinaryReader
|
||||
|
||||
|
||||
class MtProtoPlainSender:
|
||||
|
||||
@@ -4,11 +4,10 @@ import re
|
||||
import zlib
|
||||
from time import sleep
|
||||
|
||||
from crypto.aes import AES
|
||||
from utils.binary_writer import BinaryWriter
|
||||
from utils.binary_reader import BinaryReader
|
||||
from tl.types.msgs_ack import MsgsAck
|
||||
import utils.helpers as helpers
|
||||
import utils
|
||||
from crypto import AES
|
||||
from utils import BinaryWriter, BinaryReader
|
||||
from tl.types import MsgsAck
|
||||
|
||||
|
||||
class MtProtoSender:
|
||||
@@ -74,9 +73,9 @@ class MtProtoSender:
|
||||
writer.write_int(len(packet))
|
||||
writer.write(packet)
|
||||
|
||||
msg_key = helpers.calc_msg_key(writer.get_bytes())
|
||||
msg_key = utils.calc_msg_key(writer.get_bytes())
|
||||
|
||||
key, iv = helpers.calc_key(self.session.auth_key.key, msg_key, True)
|
||||
key, iv = utils.calc_key(self.session.auth_key.key, msg_key, True)
|
||||
cipher_text = AES.encrypt_ige(writer.get_bytes(), key, iv)
|
||||
|
||||
# And then finally send the packet
|
||||
@@ -101,7 +100,7 @@ class MtProtoSender:
|
||||
remote_auth_key_id = reader.read_long()
|
||||
msg_key = reader.read(16)
|
||||
|
||||
key, iv = helpers.calc_key(self.session.auth_key.data, msg_key, False)
|
||||
key, iv = utils.calc_key(self.session.auth_key.data, msg_key, False)
|
||||
plain_text = AES.decrypt_ige(reader.read(len(body) - reader.tell_position()), key, iv)
|
||||
|
||||
with BinaryReader(plain_text) as plain_text_reader:
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Network/TcpMessage.cs
|
||||
from zlib import crc32
|
||||
|
||||
from utils.binary_writer import BinaryWriter
|
||||
from utils.binary_reader import BinaryReader
|
||||
from utils import BinaryWriter, BinaryReader
|
||||
|
||||
|
||||
class TcpMessage:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# This file is based on TLSharp
|
||||
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Network/TcpTransport.cs
|
||||
from zlib import crc32
|
||||
from network.tcp_message import TcpMessage
|
||||
from network.tcp_client import TcpClient
|
||||
from network import TcpMessage, TcpClient
|
||||
|
||||
|
||||
class TcpTransport:
|
||||
|
||||
Reference in New Issue
Block a user