Browse Source

tls1.2 split pack data

dev
破娃酱 8 years ago
parent
commit
13ffdac2b7
  1. 2
      CHANGES
  2. 13
      shadowsocks/obfsplugin/obfs_tls.py

2
CHANGES

@ -1,4 +1,4 @@
2.9.5.1 2016-10-17 2.9.6 2016-10-17
- tls1.2_ticket_auth random packet size - tls1.2_ticket_auth random packet size
2.9.5.1 2016-10-16 2.9.5.1 2016-10-16

13
shadowsocks/obfsplugin/obfs_tls.py

@ -84,7 +84,14 @@ class tls_ticket_auth(plain.plain):
if self.handshake_status == -1: if self.handshake_status == -1:
return buf return buf
if self.handshake_status == 8: if self.handshake_status == 8:
return b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf ret = b''
while len(buf) > 2048:
size = min(struct.unpack('>H', os.urandom(2))[0] % 4096 + 100, len(buf))
ret += b"\x17" + self.tls_version + struct.pack('>H', size) + buf[:size]
buf = buf[size:]
if len(buf) > 0:
ret += b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf
return ret
self.send_buffer += b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf self.send_buffer += b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf
if self.handshake_status == 0: if self.handshake_status == 0:
self.handshake_status = 1 self.handshake_status = 1
@ -149,8 +156,8 @@ class tls_ticket_auth(plain.plain):
return buf return buf
if self.handshake_status == 8: if self.handshake_status == 8:
ret = b'' ret = b''
while len(buf) > 4196: while len(buf) > 2048:
size = struct.unpack('>H', os.urandom(2))[0] % 4096 + 100 size = min(struct.unpack('>H', os.urandom(2))[0] % 4096 + 100, len(buf))
ret += b"\x17" + self.tls_version + struct.pack('>H', size) + buf[:size] ret += b"\x17" + self.tls_version + struct.pack('>H', size) + buf[:size]
buf = buf[size:] buf = buf[size:]
if len(buf) > 0: if len(buf) > 0:

Loading…
Cancel
Save