import struct import random import os from .connection import Connection, PacketCodec class IntermediatePacketCodec(PacketCodec): tag = b'\xee\xee\xee\xee' obfuscate_tag = tag def encode_packet(self, data): return struct.pack(' 0: return packet_with_padding[:-pad_size] return packet_with_padding class ConnectionTcpIntermediate(Connection): """ Intermediate mode between `ConnectionTcpFull` and `ConnectionTcpAbridged`. Always sends 4 extra bytes for the packet length. """ packet_codec = IntermediatePacketCodec