コード例 #1
0
        /// <summary>
        /// find the nt transaction packets
        /// </summary>
        /// <param name="command">the command of nt transaction</param>
        /// <param name="setup">the setup contains the sub command</param>
        /// <returns>the target nt transaction packet</returns>
        private static SmbPacket FindTheNtTransPacket(NtTransSubCommand command, byte[] setup)
        {
            SmbPacket smbPacket = null;

            switch (command)
            {
            case NtTransSubCommand.NT_TRANSACT_CREATE:
                smbPacket = new SmbNtTransactCreateRequestPacket();
                break;

            case NtTransSubCommand.NT_TRANSACT_RENAME:
                smbPacket = new SmbNtTransRenameRequestPacket();
                break;

            case NtTransSubCommand.NT_TRANSACT_IOCTL:
                NT_TRANSACT_IOCTL_SETUP subCommand = CifsMessageUtils.ToStuct <NT_TRANSACT_IOCTL_SETUP>(setup);
                switch ((NtTransFunctionCode)subCommand.FunctionCode)
                {
                case NtTransFunctionCode.FSCTL_SRV_ENUMERATE_SNAPSHOTS:
                    smbPacket = new SmbNtTransFsctlSrvEnumerateSnapshotsRequestPacket();
                    break;

                case NtTransFunctionCode.FSCTL_SRV_REQUEST_RESUME_KEY:
                    smbPacket = new SmbNtTransFsctlSrvRequestResumeKeyRequestPacket();
                    break;

                case NtTransFunctionCode.FSCTL_SRV_COPYCHUNK:
                    smbPacket = new SmbNtTransFsctlSrvCopyChunkRequestPacket();
                    break;

                default:
                    smbPacket = new SmbNtTransactIoctlRequestPacket();
                    break;
                }
                break;

            default:
                switch ((SmbNtTransSubCommand)command)
                {
                case SmbNtTransSubCommand.NT_TRANSACT_QUERY_QUOTA:
                    smbPacket = new SmbNtTransQueryQuotaRequestPacket();
                    break;

                case SmbNtTransSubCommand.NT_TRANSACT_SET_QUOTA:
                    smbPacket = new SmbNtTransSetQuotaRequestPacket();
                    break;
                }
                break;
            }

            return(smbPacket);
        }
コード例 #2
0
        /// <summary>
        /// find the nt transaction packets
        /// </summary>
        /// <param name="command">the command of nt transaction</param>
        /// <param name="setup">the setup contains the sub command</param>
        /// <returns>the target nt transaction packet</returns>
        private static SmbPacket FindTheNtTransPacket(NtTransSubCommand command, byte[] setup)
        {
            SmbPacket smbPacket = null;
            switch (command)
            {
                case NtTransSubCommand.NT_TRANSACT_CREATE:
                    smbPacket = new SmbNtTransactCreateRequestPacket();
                    break;

                case NtTransSubCommand.NT_TRANSACT_RENAME:
                    smbPacket = new SmbNtTransRenameRequestPacket();
                    break;

                case NtTransSubCommand.NT_TRANSACT_IOCTL:
                    NT_TRANSACT_IOCTL_SETUP subCommand = CifsMessageUtils.ToStuct<NT_TRANSACT_IOCTL_SETUP>(setup);
                    switch ((NtTransFunctionCode)subCommand.FunctionCode)
                    {
                        case NtTransFunctionCode.FSCTL_SRV_ENUMERATE_SNAPSHOTS:
                            smbPacket = new SmbNtTransFsctlSrvEnumerateSnapshotsRequestPacket();
                            break;

                        case NtTransFunctionCode.FSCTL_SRV_REQUEST_RESUME_KEY:
                            smbPacket = new SmbNtTransFsctlSrvRequestResumeKeyRequestPacket();
                            break;

                        case NtTransFunctionCode.FSCTL_SRV_COPYCHUNK:
                            smbPacket = new SmbNtTransFsctlSrvCopyChunkRequestPacket();
                            break;

                        default:
                            smbPacket = new SmbNtTransactIoctlRequestPacket();
                            break;
                    }
                    break;

                default:
                    switch ((SmbNtTransSubCommand)command)
                    {
                        case SmbNtTransSubCommand.NT_TRANSACT_QUERY_QUOTA:
                            smbPacket = new SmbNtTransQueryQuotaRequestPacket();
                            break;

                        case SmbNtTransSubCommand.NT_TRANSACT_SET_QUOTA:
                            smbPacket = new SmbNtTransSetQuotaRequestPacket();
                            break;
                    }
                    break;
            }

            return smbPacket;
        }