mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 10:47:48 +02:00
Renamed Version to NTLMVersion
This commit is contained in:
parent
457d978f70
commit
d45efdcaa8
9 changed files with 22 additions and 19 deletions
|
@ -27,7 +27,7 @@ namespace SMBLibrary.Authentication
|
|||
public string WorkStation;
|
||||
public byte[] EncryptedRandomSessionKey;
|
||||
public NegotiateFlags NegotiateFlags;
|
||||
public Version Version;
|
||||
public NTLMVersion Version;
|
||||
// 16-byte MIC field is omitted for Windows NT / 2000 / XP / Server 2003
|
||||
|
||||
public AuthenticateMessage()
|
||||
|
@ -53,7 +53,7 @@ namespace SMBLibrary.Authentication
|
|||
NegotiateFlags = (NegotiateFlags)LittleEndianConverter.ToUInt32(buffer, 60);
|
||||
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
||||
{
|
||||
Version = new Version(buffer, 64);
|
||||
Version = new NTLMVersion(buffer, 64);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace SMBLibrary.Authentication
|
|||
public byte[] ServerChallenge; // 8 bytes
|
||||
// Reserved - 8 bytes
|
||||
public byte[] TargetInfo; // sequence of AV_PAIR structures
|
||||
public Version Version;
|
||||
public NTLMVersion Version;
|
||||
|
||||
public ChallengeMessage()
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace SMBLibrary.Authentication
|
|||
TargetInfo = AuthenticationMessageUtils.ReadBufferPointer(buffer, 40);
|
||||
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
||||
{
|
||||
Version = new Version(buffer, 48);
|
||||
Version = new NTLMVersion(buffer, 48);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,10 @@ using Utilities;
|
|||
|
||||
namespace SMBLibrary.Authentication
|
||||
{
|
||||
public class Version
|
||||
/// <summary>
|
||||
/// [MS-NLMP] 2.2.2.10 - VERSION
|
||||
/// </summary>
|
||||
public class NTLMVersion
|
||||
{
|
||||
public const byte NTLMSSP_REVISION_W2K3 = 0x0F;
|
||||
|
||||
|
@ -21,7 +24,7 @@ namespace SMBLibrary.Authentication
|
|||
// Reserved - 3 bytes
|
||||
public byte NTLMRevisionCurrent;
|
||||
|
||||
public Version(byte majorVersion, byte minorVersion, ushort build, byte ntlmRevisionCurrent)
|
||||
public NTLMVersion(byte majorVersion, byte minorVersion, ushort build, byte ntlmRevisionCurrent)
|
||||
{
|
||||
ProductMajorVersion = majorVersion;
|
||||
ProductMinorVersion = minorVersion;
|
||||
|
@ -29,7 +32,7 @@ namespace SMBLibrary.Authentication
|
|||
NTLMRevisionCurrent = ntlmRevisionCurrent;
|
||||
}
|
||||
|
||||
public Version(byte[] buffer, int offset)
|
||||
public NTLMVersion(byte[] buffer, int offset)
|
||||
{
|
||||
ProductMajorVersion = ByteReader.ReadByte(buffer, offset + 0);
|
||||
ProductMinorVersion = ByteReader.ReadByte(buffer, offset + 1);
|
||||
|
@ -45,19 +48,19 @@ namespace SMBLibrary.Authentication
|
|||
ByteWriter.WriteByte(buffer, offset + 7, NTLMRevisionCurrent);
|
||||
}
|
||||
|
||||
public static Version WindowsXP
|
||||
public static NTLMVersion WindowsXP
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Version(5, 1, 2600, NTLMSSP_REVISION_W2K3);
|
||||
return new NTLMVersion(5, 1, 2600, NTLMSSP_REVISION_W2K3);
|
||||
}
|
||||
}
|
||||
|
||||
public static Version Server2003
|
||||
public static NTLMVersion Server2003
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Version(5, 2, 3790, NTLMSSP_REVISION_W2K3);
|
||||
return new NTLMVersion(5, 2, 3790, NTLMSSP_REVISION_W2K3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ namespace SMBLibrary.Authentication
|
|||
public NegotiateFlags NegotiateFlags;
|
||||
public string DomainName;
|
||||
public string Workstation;
|
||||
public Version Version;
|
||||
public NTLMVersion Version;
|
||||
|
||||
public NegotiateMessage()
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace SMBLibrary.Authentication
|
|||
Workstation = AuthenticationMessageUtils.ReadAnsiStringBufferPointer(buffer, 24);
|
||||
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
||||
{
|
||||
Version = new Version(buffer, 32);
|
||||
Version = new NTLMVersion(buffer, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<Compile Include="Authentication\AuthenticateMessage\Enums\NegotiateFlags.cs" />
|
||||
<Compile Include="Authentication\AuthenticateMessage\NegotiateMessage.cs" />
|
||||
<Compile Include="Authentication\AuthenticateMessage\NTLMv2ClientChallenge.cs" />
|
||||
<Compile Include="Authentication\AuthenticateMessage\Version.cs" />
|
||||
<Compile Include="Authentication\AuthenticateMessage\NTLMVersion.cs" />
|
||||
<Compile Include="Authentication\GSSAPI\DerEncodingHelper.cs" />
|
||||
<Compile Include="Authentication\GSSAPI\GSSAPIHelper.cs" />
|
||||
<Compile Include="Authentication\GSSAPI\SimpleProtectedNegotiationToken.cs" />
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace SMBLibrary.Server
|
|||
message.TargetName = Environment.MachineName;
|
||||
message.ServerChallenge = serverChallenge;
|
||||
message.TargetInfo = AVPairUtils.GetAVPairSequence(Environment.MachineName, Environment.MachineName);
|
||||
message.Version = Authentication.Version.Server2003;
|
||||
message.Version = NTLMVersion.Server2003;
|
||||
return message;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
NegotiateFlags.Version |
|
||||
NegotiateFlags.Use128BitEncryption |
|
||||
NegotiateFlags.Use56BitEncryption;
|
||||
negotiateMessage.Version = Authentication.Version.Server2003;
|
||||
negotiateMessage.Version = NTLMVersion.Server2003;
|
||||
return negotiateMessage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
authenticateMessage.UserName = accountNameToAuth;
|
||||
authenticateMessage.LmChallengeResponse = lmChallengeResponse;
|
||||
authenticateMessage.NtChallengeResponse = ntChallengeResponse;
|
||||
authenticateMessage.Version = Authentication.Version.Server2003;
|
||||
authenticateMessage.Version = NTLMVersion.Server2003;
|
||||
return authenticateMessage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace SMBLibrary
|
|||
byte[] serverChallenge = new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
|
||||
ChallengeMessage message = new ChallengeMessage();
|
||||
message.ServerChallenge = serverChallenge;
|
||||
message.Version = new Authentication.Version(6, 0, 6000, 15);
|
||||
message.Version = new NTLMVersion(6, 0, 6000, 15);
|
||||
message.NegotiateFlags = NegotiateFlags.UnicodeEncoding | NegotiateFlags.OEMEncoding | NegotiateFlags.Sign | NegotiateFlags.Seal | NegotiateFlags.NTLMKey | NegotiateFlags.AlwaysSign | NegotiateFlags.TargetTypeServer | NegotiateFlags.ExtendedSecurity | NegotiateFlags.TargetInfo | NegotiateFlags.Version | NegotiateFlags.Use128BitEncryption | NegotiateFlags.KeyExchange | NegotiateFlags.Use56BitEncryption;
|
||||
message.TargetName = "Server";
|
||||
byte[] serverAVPair = AVPairUtils.GetAVPairSequence("Domain", "Server");
|
||||
|
@ -138,7 +138,7 @@ namespace SMBLibrary
|
|||
|
||||
AuthenticateMessage message = new AuthenticateMessage();
|
||||
message.EncryptedRandomSessionKey = sessionKey;
|
||||
message.Version = new Authentication.Version(5, 1, 2600, Authentication.Version.NTLMSSP_REVISION_W2K3);
|
||||
message.Version = new NTLMVersion(5, 1, 2600, Authentication.NTLMVersion.NTLMSSP_REVISION_W2K3);
|
||||
message.NegotiateFlags = NegotiateFlags.UnicodeEncoding | NegotiateFlags.TargetNameSupplied | NegotiateFlags.Sign | NegotiateFlags.Seal | NegotiateFlags.NTLMKey | NegotiateFlags.AlwaysSign | NegotiateFlags.ExtendedSecurity | NegotiateFlags.TargetInfo | NegotiateFlags.Version | NegotiateFlags.Use128BitEncryption | NegotiateFlags.KeyExchange | NegotiateFlags.Use56BitEncryption;
|
||||
message.DomainName = "Domain";
|
||||
message.WorkStation = "COMPUTER";
|
||||
|
|
Loading…
Add table
Reference in a new issue