diff --git a/telethon/network/authenticator.py b/telethon/network/authenticator.py index 60614581..7204433d 100755 --- a/telethon/network/authenticator.py +++ b/telethon/network/authenticator.py @@ -124,6 +124,7 @@ def do_authentication(transport): g, dh_prime, ga, time_offset = None, None, None, None with BinaryReader(plain_text_answer) as dh_inner_data_reader: + dh_inner_data_reader.read(20) # hashsum code = dh_inner_data_reader.read_int(signed=False) if code != 0xb5890dba: raise AssertionError('Invalid DH Inner Data code: {}'.format(code)) diff --git a/telethon/network/mtproto_plain_sender.py b/telethon/network/mtproto_plain_sender.py index 094b0075..57d7a60e 100755 --- a/telethon/network/mtproto_plain_sender.py +++ b/telethon/network/mtproto_plain_sender.py @@ -28,8 +28,8 @@ class MtProtoPlainSender: """Receives a plain packet, returning the body of the response""" seq, body = self._transport.receive() with BinaryReader(body) as reader: - auth_key_id = reader.read_long() - msg_id = reader.read_long() + reader.read_long() # auth_key_id + reader.read_long() # msg_id message_length = reader.read_int() response = reader.read(message_length) diff --git a/telethon/network/mtproto_sender.py b/telethon/network/mtproto_sender.py index 65c84257..2b50cf2c 100755 --- a/telethon/network/mtproto_sender.py +++ b/telethon/network/mtproto_sender.py @@ -168,7 +168,7 @@ class MtProtoSender: raise BufferError("Can't decode packet ({})".format(body)) # TODO Check for both auth key ID and msg_key correctness - remote_auth_key_id = reader.read_long() + reader.read_long() # remote_auth_key_id msg_key = reader.read(16) key, iv = utils.calc_key(self.session.auth_key.key, msg_key, False) @@ -176,8 +176,8 @@ class MtProtoSender: reader.read(len(body) - reader.tell_position()), key, iv) with BinaryReader(plain_text) as plain_text_reader: - remote_salt = plain_text_reader.read_long() - remote_session_id = plain_text_reader.read_long() + plain_text_reader.read_long() # remote_salt + plain_text_reader.read_long() # remote_session_id remote_msg_id = plain_text_reader.read_long() remote_sequence = plain_text_reader.read_int() msg_len = plain_text_reader.read_int() @@ -236,11 +236,11 @@ class MtProtoSender: return False def handle_container(self, msg_id, sequence, reader, request): - code = reader.read_int(signed=False) + reader.read_int(signed=False) # code size = reader.read_int() for _ in range(size): inner_msg_id = reader.read_long(signed=False) - inner_sequence = reader.read_int() + reader.read_int() # inner_sequence inner_length = reader.read_int() begin_position = reader.tell_position() @@ -250,10 +250,10 @@ class MtProtoSender: return False def handle_bad_server_salt(self, msg_id, sequence, reader, request): - code = reader.read_int(signed=False) - bad_msg_id = reader.read_long(signed=False) - bad_msg_seq_no = reader.read_int() - error_code = reader.read_int() + reader.read_int(signed=False) # code + reader.read_long(signed=False) # bad_msg_id + reader.read_int() # bad_msg_seq_no + reader.read_int() # error_code new_salt = reader.read_long(signed=False) self.session.salt = new_salt @@ -268,15 +268,15 @@ class MtProtoSender: return True def handle_bad_msg_notification(self, msg_id, sequence, reader): - code = reader.read_int(signed=False) - request_id = reader.read_long(signed=False) - request_sequence = reader.read_int() + reader.read_int(signed=False) # code + reader.read_long(signed=False) # request_id + reader.read_int() # request_sequence error_code = reader.read_int() raise BadMessageError(error_code) def handle_rpc_result(self, msg_id, sequence, reader, request): - code = reader.read_int(signed=False) + reader.read_int(signed=False) # code request_id = reader.read_long(signed=False) inner_code = reader.read_int(signed=False) @@ -317,7 +317,7 @@ class MtProtoSender: request.on_response(reader) def handle_gzip_packed(self, msg_id, sequence, reader, request): - code = reader.read_int(signed=False) + reader.read_int(signed=False) # code packed_data = reader.tgread_bytes() unpacked_data = gzip.decompress(packed_data)