Translating...
This commit is contained in:
parent
d4bdc545a4
commit
ddd92f5b30
2
TL.py
2
TL.py
@ -117,8 +117,8 @@ def deserialize(bytes_io, type_=None, subtype=None):
|
|||||||
"""
|
"""
|
||||||
:type bytes_io: io.BytesIO object
|
:type bytes_io: io.BytesIO object
|
||||||
"""
|
"""
|
||||||
|
print type_
|
||||||
assert isinstance(bytes_io, io.BytesIO)
|
assert isinstance(bytes_io, io.BytesIO)
|
||||||
|
|
||||||
# Built-in bare types
|
# Built-in bare types
|
||||||
if type_ == 'int': x = struct.unpack('<i', bytes_io.read(4))[0]
|
if type_ == 'int': x = struct.unpack('<i', bytes_io.read(4))[0]
|
||||||
elif type_ == '#': x = struct.unpack('<I', bytes_io.read(4))[0]
|
elif type_ == '#': x = struct.unpack('<I', bytes_io.read(4))[0]
|
||||||
|
BIN
mtproto.php
BIN
mtproto.php
Binary file not shown.
@ -106,12 +106,11 @@ class Session:
|
|||||||
if not crc32(packet_length_data + packet[0:-4]) == struct.unpack('<I', packet[-4:])[0]:
|
if not crc32(packet_length_data + packet[0:-4]) == struct.unpack('<I', packet[-4:])[0]:
|
||||||
raise Exception("CRC32 was not correct!")
|
raise Exception("CRC32 was not correct!")
|
||||||
x = struct.unpack("<I", packet[:4])
|
x = struct.unpack("<I", packet[:4])
|
||||||
print x[0]
|
|
||||||
auth_key_id = packet[4:12]
|
auth_key_id = packet[4:12]
|
||||||
if auth_key_id == b'\x00\x00\x00\x00\x00\x00\x00\x00':
|
if auth_key_id == b'\x00\x00\x00\x00\x00\x00\x00\x00':
|
||||||
# No encryption - Plain text
|
# No encryption - Plain text
|
||||||
(message_id, message_length) = struct.unpack("<8sI", packet[12:24])
|
(message_id, message_length) = struct.unpack("<8sI", packet[12:24])
|
||||||
print struct.unpack("<8sI", packet[12:24])
|
|
||||||
data = packet[24:24+message_length]
|
data = packet[24:24+message_length]
|
||||||
elif auth_key_id == self.auth_key_id:
|
elif auth_key_id == self.auth_key_id:
|
||||||
message_key = packet[12:28]
|
message_key = packet[12:28]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user