Пример #1
0
        public TreeConnectAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset)
        {
            OptionalSupport = (OptionalSupportFlags)LittleEndianConverter.ToUInt16(SMBParameters, 4);

            int    dataOffset    = 0;
            string serviceString = ByteReader.ReadNullTerminatedAnsiString(SMBData, ref dataOffset);

            NativeFileSystem = SMB1Helper.ReadSMBString(SMBData, ref dataOffset, isUnicode);

            Service = ServiceNameHelper.GetServiceName(serviceString);
        }
Пример #2
0
        public TreeConnectAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            int parametersOffset = 4;

            OptionalSupport               = (OptionalSupportFlags)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset);
            MaximalShareAccessRights      = new AccessMask(this.SMBParameters, ref parametersOffset);
            GuestMaximalShareAccessRights = new AccessMask(this.SMBParameters, ref parametersOffset);

            int    dataOffset    = 0;
            string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset);

            NativeFileSystem = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);

            Service = ServiceNameHelper.GetServiceName(serviceString);
        }
Пример #3
0
        public TreeConnectAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset)
        {
            int parametersOffset = 4;

            Flags = (TreeConnectFlags)LittleEndianReader.ReadUInt16(SMBParameters, ref parametersOffset);
            ushort passwordLength = LittleEndianReader.ReadUInt16(SMBParameters, ref parametersOffset);

            int dataOffset = 0;

            Password = ByteReader.ReadBytes(SMBData, ref dataOffset, passwordLength);
            if (isUnicode)
            {
                // wordCount is 1 byte
                int padding = (1 + passwordLength) % 2;
                dataOffset += padding;
            }
            Path = SMB1Helper.ReadSMBString(SMBData, ref dataOffset, isUnicode);
            // Should be read as OEM string but it doesn't really matter
            string serviceString = ByteReader.ReadNullTerminatedAnsiString(SMBData, ref dataOffset);

            Service = ServiceNameHelper.GetServiceName(serviceString);
        }