コード例 #1
0
        public SessionSetupAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            Action = (SessionSetupAction)LittleEndianConverter.ToUInt16(this.SMBParameters, 4);

            int dataOffset = 0;

            if (isUnicode)
            {
                dataOffset++;
            }
            NativeOS      = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            NativeLanMan  = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            PrimaryDomain = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
        }
コード例 #2
0
        public SessionSetupAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            Action = (SessionSetupAction)LittleEndianConverter.ToUInt16(this.SMBParameters, 4);

            int dataOffset = 0;

            if (isUnicode)
            {
                // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                // Note: SMBData starts at an odd offset.
                dataOffset++;
            }
            NativeOS      = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            NativeLanMan  = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            PrimaryDomain = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
        }
コード例 #3
0
        public SessionSetupAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            Action             = (SessionSetupAction)LittleEndianConverter.ToUInt16(this.SMBParameters, 4);
            SecurityBlobLength = LittleEndianConverter.ToUInt16(this.SMBParameters, 6);

            SecurityBlob = ByteReader.ReadBytes(this.SMBData, 0, SecurityBlobLength);

            int dataOffset = SecurityBlob.Length;

            if (isUnicode)
            {
                // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                // Note: SMBData starts at an odd offset.
                int padding = (SecurityBlobLength + 1) % 2;
                dataOffset += padding;
            }
            NativeOS     = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            NativeLanMan = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
        }
コード例 #4
0
        public SessionSetupAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            Action = (SessionSetupAction)LittleEndianConverter.ToUInt16(this.SMBParameters, 4);

            int dataOffset = 0;

            if (isUnicode)
            {
                // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                // Note: SMBData starts at an odd offset.
                dataOffset++;
            }
            NativeOS     = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            NativeLanMan = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
            if ((this.SMBData.Length - dataOffset) % 2 == 1)
            {
                // Workaround for a single terminating null byte
                this.SMBData = ByteUtils.Concatenate(this.SMBData, new byte[1]);
            }
            PrimaryDomain = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
        }
コード例 #5
0
        public SessionSetupAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset)
        {
            Action             = (SessionSetupAction)LittleEndianConverter.ToUInt16(SMBParameters, 4);
            SecurityBlobLength = LittleEndianConverter.ToUInt16(SMBParameters, 6);

            SecurityBlob = ByteReader.ReadBytes(SMBData, 0, SecurityBlobLength);

            int dataOffset = SecurityBlob.Length;

            if (isUnicode)
            {
                // A Unicode string MUST be aligned to a 16-bit boundary with respect to the beginning of the SMB Header.
                // Note: SMBData starts at an odd offset.
                int padding = (1 + SecurityBlobLength) % 2;
                dataOffset += padding;
            }
            NativeOS = SMB1Helper.ReadSMBString(SMBData, ref dataOffset, isUnicode);
            if ((SMBData.Length - dataOffset) % 2 == 1)
            {
                // Workaround for a single terminating null byte
                SMBData = ByteUtils.Concatenate(SMBData, new byte[1]);
            }
            NativeLanMan = SMB1Helper.ReadSMBString(SMBData, ref dataOffset, isUnicode);
        }