|
|
@ -21,7 +21,7 @@ from __future__ import absolute_import, division, print_function, \ |
|
|
|
import socket |
|
|
|
import struct |
|
|
|
import logging |
|
|
|
|
|
|
|
import binascii |
|
|
|
|
|
|
|
def compat_ord(s): |
|
|
|
if type(s) == int: |
|
|
@ -160,6 +160,21 @@ def pre_parse_header(data): |
|
|
|
'encryption method') |
|
|
|
return None |
|
|
|
data = data[rand_data_size + 3:] |
|
|
|
elif datatype == 0x88: |
|
|
|
if len(data) <= 7 + 7: |
|
|
|
return None |
|
|
|
data_size = struct.unpack('>H', data[1:3])[0] |
|
|
|
ogn_data = data |
|
|
|
data = data[:data_size] |
|
|
|
crc = binascii.crc32(data) & 0xffffffff |
|
|
|
if crc != 0xffffffff: |
|
|
|
logging.warn('uncorrect CRC32, maybe wrong password or ' |
|
|
|
'encryption method') |
|
|
|
return None |
|
|
|
start_pos = 3 + ord(data[3]) |
|
|
|
data = data[start_pos:-4] |
|
|
|
if data_size < len(ogn_data): |
|
|
|
data += ogn_data[data_size:] |
|
|
|
return data |
|
|
|
|
|
|
|
def parse_header(data): |
|
|
|