예제 #1
0
    def parseDeviceCreateRequest(self, deviceID: int, fileID: int, completionID: int, minorFunction: int, stream: BytesIO) -> DeviceCreateRequestPDU:
        desiredAccess = Uint32LE.unpack(stream)
        allocationSize = Uint64LE.unpack(stream)
        fileAttributes = FileAttributes(Uint32LE.unpack(stream))
        sharedAccess = FileShareAccess(Uint32LE.unpack(stream))
        createDisposition = FileCreateDisposition(Uint32LE.unpack(stream))
        createOptions = FileCreateOptions(Uint32LE.unpack(stream))
        pathLength = Uint32LE.unpack(stream)
        path = stream.read(pathLength)

        path = decodeUTF16LE(path)[: -1]

        return DeviceCreateRequestPDU(
            deviceID,
            fileID,
            completionID,
            minorFunction,
            desiredAccess,
            allocationSize,
            fileAttributes,
            sharedAccess,
            createDisposition,
            createOptions,
            path
        )
예제 #2
0
        def send(self):
            if "*" not in self.path:
                openPath = self.path
            else:
                openPath = self.path[: self.path.index("*")]

            if openPath.endswith("\\"):
                openPath = openPath[: -1]

            # We need to start by opening the directory.
            request = DeviceCreateRequestPDU(
                self.deviceID,
                0,
                self.requestID,
                0,
                DirectoryAccessMask.FILE_LIST_DIRECTORY,
                0,
                FileAttributes.FILE_ATTRIBUTE_DIRECTORY,
                FileShareAccess(7), # read, write, delete
                FileCreateDisposition.FILE_OPEN,
                FileCreateOptions.FILE_DIRECTORY_FILE,
                openPath
            )

            self.sendIORequest(request)
예제 #3
0
        def send(self):
            # Open the file
            request = DeviceCreateRequestPDU(
                self.deviceID,
                0,
                self.requestID,
                0,
                FileAccessMask.FILE_READ_DATA,
                0,
                FileAttributes.FILE_ATTRIBUTE_NONE,
                FileShareAccess(7),  # read, write, delete
                FileCreateDisposition.FILE_OPEN,
                FileCreateOptions.FILE_NON_DIRECTORY_FILE,
                self.path)

            self.sendIORequest(request)