Ejemplo n.º 1
0
 def parseDeviceIORequest(self, stream: BytesIO) -> DeviceIORequestPDU:
     """
     Starts after the rdpdr header.
     """
     deviceId = Uint32LE.unpack(stream)
     fileId = Uint32LE.unpack(stream)
     completionId = Uint32LE.unpack(stream)
     majorFunction = MajorFunction(Uint32LE.unpack(stream))
     minorFunction = Uint32LE.unpack(stream)
     if majorFunction in self.ioRequestParsers.keys():
         return self.ioRequestParsers[majorFunction](deviceId, fileId, completionId,
                                                     minorFunction, stream)
     else:
         return DeviceIORequestPDU(deviceId, fileId, completionId, majorFunction, minorFunction, payload=stream.read())
Ejemplo n.º 2
0
    def parseDeviceIORequest(self, stream: BytesIO) -> DeviceIORequestPDU:
        deviceID = Uint32LE.unpack(stream)
        fileID = Uint32LE.unpack(stream)
        completionID = Uint32LE.unpack(stream)
        majorFunction = MajorFunction(Uint32LE.unpack(stream))
        minorFunction = Uint32LE.unpack(stream)

        if majorFunction == MajorFunction.IRP_MJ_DIRECTORY_CONTROL:
            minorFunction = MinorFunction(minorFunction)

        if majorFunction in self.ioRequestParsers.keys():
            self.majorFunctionsForParsingResponse[completionID] = majorFunction
            return self.ioRequestParsers[majorFunction](deviceID, fileID, completionID, minorFunction, stream)
        else:
            return DeviceIORequestPDU(deviceID, fileID, completionID, majorFunction, minorFunction, payload=stream.read())