mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-11 18:09:19 +02:00
Use InvalidDataException instead of InvalidRequestException
This commit is contained in:
parent
9a2b1949f0
commit
62cea47d96
21 changed files with 48 additions and 72 deletions
|
@ -1,23 +0,0 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
|
||||||
*
|
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
|
||||||
* either version 3 of the License, or (at your option) any later version.
|
|
||||||
*/
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace SMBLibrary
|
|
||||||
{
|
|
||||||
public class InvalidRequestException : Exception
|
|
||||||
{
|
|
||||||
public InvalidRequestException() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public InvalidRequestException(string message) : base(message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.NetBios
|
namespace SMBLibrary.NetBios
|
||||||
|
@ -55,7 +56,6 @@ namespace SMBLibrary.NetBios
|
||||||
/// HasCompletePacket must be called and return true before calling DequeuePacket
|
/// HasCompletePacket must be called and return true before calling DequeuePacket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="System.IO.InvalidDataException"></exception>
|
/// <exception cref="System.IO.InvalidDataException"></exception>
|
||||||
/// <exception cref="SMBLibrary.InvalidRequestException"></exception>
|
|
||||||
public SessionPacket DequeuePacket()
|
public SessionPacket DequeuePacket()
|
||||||
{
|
{
|
||||||
SessionPacket packet;
|
SessionPacket packet;
|
||||||
|
@ -65,7 +65,7 @@ namespace SMBLibrary.NetBios
|
||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException ex)
|
catch (IndexOutOfRangeException ex)
|
||||||
{
|
{
|
||||||
throw new System.IO.InvalidDataException("Invalid NetBIOS session packet", ex);
|
throw new InvalidDataException("Invalid NetBIOS session packet", ex);
|
||||||
}
|
}
|
||||||
RemovePacketBytes();
|
RemovePacketBytes();
|
||||||
return packet;
|
return packet;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.NetBios
|
namespace SMBLibrary.NetBios
|
||||||
|
@ -80,7 +81,7 @@ namespace SMBLibrary.NetBios
|
||||||
case SessionPacketTypeName.SessionKeepAlive:
|
case SessionPacketTypeName.SessionKeepAlive:
|
||||||
return new SessionKeepAlivePacket(buffer, offset);
|
return new SessionKeepAlivePacket(buffer, offset);
|
||||||
default:
|
default:
|
||||||
throw new InvalidRequestException("Invalid NetBIOS session packet type: 0x" + type.ToString("X"));
|
throw new InvalidDataException("Invalid NetBIOS session packet type: 0x" + type.ToString("X"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -32,7 +32,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -34,7 +34,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -31,7 +31,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
DirectoryName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -36,7 +36,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -32,7 +32,7 @@ namespace SMBLibrary.SMB1
|
||||||
byte bufferFormat = ByteReader.ReadByte(this.SMBData, ref dataOffset);
|
byte bufferFormat = ByteReader.ReadByte(this.SMBData, ref dataOffset);
|
||||||
if (bufferFormat != SupportedBufferFormat)
|
if (bufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
string dialect = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, dataOffset);
|
string dialect = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, dataOffset);
|
||||||
Dialects.Add(dialect);
|
Dialects.Add(dialect);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -34,7 +34,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -39,7 +39,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
ushort CountOfBytesRead = LittleEndianConverter.ToUInt16(this.SMBData, 1);
|
ushort CountOfBytesRead = LittleEndianConverter.ToUInt16(this.SMBData, 1);
|
||||||
Bytes = ByteReader.ReadBytes(this.SMBData, 3, CountOfBytesRead);
|
Bytes = ByteReader.ReadBytes(this.SMBData, 3, CountOfBytesRead);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -40,13 +40,13 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat1 = ByteReader.ReadByte(this.SMBData, ref dataOffset);
|
BufferFormat1 = ByteReader.ReadByte(this.SMBData, ref dataOffset);
|
||||||
if (BufferFormat1 != SupportedBufferFormat)
|
if (BufferFormat1 != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
OldFileName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
|
OldFileName = SMB1Helper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);
|
||||||
BufferFormat2 = ByteReader.ReadByte(this.SMBData, ref dataOffset);
|
BufferFormat2 = ByteReader.ReadByte(this.SMBData, ref dataOffset);
|
||||||
if (BufferFormat2 != SupportedBufferFormat)
|
if (BufferFormat2 != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
if (isUnicode)
|
if (isUnicode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace SMBLibrary.SMB1
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException();
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case CommandName.SMB_COM_LOGOFF_ANDX:
|
case CommandName.SMB_COM_LOGOFF_ANDX:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -41,7 +41,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -46,7 +46,7 @@ namespace SMBLibrary.SMB1
|
||||||
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
|
||||||
if (BufferFormat != SupportedBufferFormat)
|
if (BufferFormat != SupportedBufferFormat)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Unsupported Buffer Format");
|
throw new InvalidDataException("Unsupported Buffer Format");
|
||||||
}
|
}
|
||||||
ushort dataLength = LittleEndianConverter.ToUInt16(this.SMBData, 1);
|
ushort dataLength = LittleEndianConverter.ToUInt16(this.SMBData, 1);
|
||||||
Data = ByteReader.ReadBytes(this.SMBData, 3, dataLength);
|
Data = ByteReader.ReadBytes(this.SMBData, 3, dataLength);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -52,7 +52,7 @@ namespace SMBLibrary.SMB1
|
||||||
case NTTransactSubcommandName.NT_TRANSACT_QUERY_SECURITY_DESC:
|
case NTTransactSubcommandName.NT_TRANSACT_QUERY_SECURITY_DESC:
|
||||||
return new NTTransactQuerySecurityDescriptorRequest(parameters);
|
return new NTTransactQuerySecurityDescriptorRequest(parameters);
|
||||||
}
|
}
|
||||||
throw new InvalidRequestException();
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -99,7 +98,7 @@ namespace SMBLibrary.SMB1
|
||||||
{
|
{
|
||||||
if (!SMB1Header.IsValidSMB1Header(buffer))
|
if (!SMB1Header.IsValidSMB1Header(buffer))
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException("Invalid SMB header signature");
|
throw new InvalidDataException("Invalid SMB header signature");
|
||||||
}
|
}
|
||||||
return new SMB1Message(buffer);
|
return new SMB1Message(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
/* Copyright (C) 2014-2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
|
||||||
*
|
*
|
||||||
* You can redistribute this program and/or modify it under the terms of
|
* You can redistribute this program and/or modify it under the terms of
|
||||||
* the GNU Lesser Public License as published by the Free Software Foundation,
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -66,7 +66,7 @@ namespace SMBLibrary.SMB1
|
||||||
return new Transaction2GetDfsReferralRequest(parameters, data);
|
return new Transaction2GetDfsReferralRequest(parameters, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new InvalidRequestException();
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
namespace SMBLibrary.SMB1
|
namespace SMBLibrary.SMB1
|
||||||
|
@ -68,7 +68,7 @@ namespace SMBLibrary.SMB1
|
||||||
return new TransactionCallNamedPipeRequest(setup, data);
|
return new TransactionCallNamedPipeRequest(setup, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new InvalidRequestException();
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
<Compile Include="Enums\SMBTransportType.cs" />
|
<Compile Include="Enums\SMBTransportType.cs" />
|
||||||
<Compile Include="Enums\Win32Error.cs" />
|
<Compile Include="Enums\Win32Error.cs" />
|
||||||
<Compile Include="EnumStructures\AccessMask.cs" />
|
<Compile Include="EnumStructures\AccessMask.cs" />
|
||||||
<Compile Include="Exceptions\InvalidRequestException.cs" />
|
|
||||||
<Compile Include="Exceptions\UnsupportedInformationLevelException.cs" />
|
<Compile Include="Exceptions\UnsupportedInformationLevelException.cs" />
|
||||||
<Compile Include="Helpers\FileTimeHelper.cs" />
|
<Compile Include="Helpers\FileTimeHelper.cs" />
|
||||||
<Compile Include="NetBios\NameServicePackets\Enums\NameRecordType.cs" />
|
<Compile Include="NetBios\NameServicePackets\Enums\NameRecordType.cs" />
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using SMBLibrary.SMB1;
|
using SMBLibrary.SMB1;
|
||||||
using Utilities;
|
using Utilities;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace SMBLibrary.Server.SMB1
|
||||||
ProcessStateObject processState = state.GetProcessState(header.PID);
|
ProcessStateObject processState = state.GetProcessState(header.PID);
|
||||||
if (processState == null)
|
if (processState == null)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException();
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
ByteWriter.WriteBytes(processState.TransactionParameters, (int)request.ParameterDisplacement, request.TransParameters);
|
ByteWriter.WriteBytes(processState.TransactionParameters, (int)request.ParameterDisplacement, request.TransParameters);
|
||||||
ByteWriter.WriteBytes(processState.TransactionData, (int)request.DataDisplacement, request.TransData);
|
ByteWriter.WriteBytes(processState.TransactionData, (int)request.DataDisplacement, request.TransData);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using SMBLibrary.SMB1;
|
using SMBLibrary.SMB1;
|
||||||
using SMBLibrary.RPC;
|
using SMBLibrary.RPC;
|
||||||
using SMBLibrary.Services;
|
using SMBLibrary.Services;
|
||||||
|
@ -71,7 +71,7 @@ namespace SMBLibrary.Server.SMB1
|
||||||
ProcessStateObject processState = state.GetProcessState(header.PID);
|
ProcessStateObject processState = state.GetProcessState(header.PID);
|
||||||
if (processState == null)
|
if (processState == null)
|
||||||
{
|
{
|
||||||
throw new InvalidRequestException();
|
throw new InvalidDataException();
|
||||||
}
|
}
|
||||||
ByteWriter.WriteBytes(processState.TransactionParameters, request.ParameterDisplacement, request.TransParameters);
|
ByteWriter.WriteBytes(processState.TransactionParameters, request.ParameterDisplacement, request.TransParameters);
|
||||||
ByteWriter.WriteBytes(processState.TransactionData, request.DataDisplacement, request.TransData);
|
ByteWriter.WriteBytes(processState.TransactionData, request.DataDisplacement, request.TransData);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue