def parseClientNetworkData(self, stream): channelCount = Uint32LE.unpack(stream) data = stream.getvalue()[4:] if len(data) != channelCount * 12: raise ParsingError("Invalid channel array size") channelDefinitions = [] for _ in range(channelCount): name = stream.read(8).strip(b"\x00").decode() options = Uint32LE.unpack(stream) channelDefinitions.append(ClientChannelDefinition(name, options)) return ClientNetworkData(channelDefinitions)
def parseClientNetworkData(self, stream: BytesIO) -> ClientNetworkData: if self.detectBlueKeepScan(stream.getvalue()): raise ExploitError("BlueKeep scan or exploit attempted") channelCount = Uint32LE.unpack(stream) data = stream.getvalue()[4 :] if len(data) != channelCount * 12: raise ParsingError("Invalid channel array size") channelDefinitions = [] for _ in range(channelCount): name = stream.read(8).strip(b"\x00").decode() options = Uint32LE.unpack(stream) channelDefinitions.append(ClientChannelDefinition(name, options)) return ClientNetworkData(channelDefinitions)