mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-14 05:15:03 +02:00
NTLM: AUTHENTICATE_MESSAGE: Do not include EncryptedRandomSessionKey if the appropriate flags are not set
This commit is contained in:
parent
adcb576976
commit
0c49e6ec29
1 changed files with 5 additions and 2 deletions
|
@ -59,13 +59,16 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
|
|
||||||
public byte[] GetBytes()
|
public byte[] GetBytes()
|
||||||
{
|
{
|
||||||
int fixedLength = 64;
|
if ((NegotiateFlags & NegotiateFlags.KeyExchange) == 0)
|
||||||
|
{
|
||||||
|
EncryptedRandomSessionKey = new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
int fixedLength = 64;
|
||||||
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
||||||
{
|
{
|
||||||
fixedLength += NTLMVersion.Length;
|
fixedLength += NTLMVersion.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int payloadLength = LmChallengeResponse.Length + NtChallengeResponse.Length + DomainName.Length * 2 + UserName.Length * 2 + WorkStation.Length * 2 + EncryptedRandomSessionKey.Length;
|
int payloadLength = LmChallengeResponse.Length + NtChallengeResponse.Length + DomainName.Length * 2 + UserName.Length * 2 + WorkStation.Length * 2 + EncryptedRandomSessionKey.Length;
|
||||||
byte[] buffer = new byte[fixedLength + payloadLength];
|
byte[] buffer = new byte[fixedLength + payloadLength];
|
||||||
ByteWriter.WriteAnsiString(buffer, 0, ValidSignature, 8);
|
ByteWriter.WriteAnsiString(buffer, 0, ValidSignature, 8);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue