scripts
This commit is contained in:
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm
|
||||
{
|
||||
// Token: 0x02000076 RID: 118
|
||||
public class ChallengeResponse : IDisposable
|
||||
{
|
||||
// Token: 0x06000437 RID: 1079 RVA: 0x0001B350 File Offset: 0x00019550
|
||||
public ChallengeResponse()
|
||||
{
|
||||
this._disposed = false;
|
||||
this._lmpwd = new byte[21];
|
||||
this._ntpwd = new byte[21];
|
||||
}
|
||||
|
||||
// Token: 0x06000438 RID: 1080 RVA: 0x0001B37C File Offset: 0x0001957C
|
||||
public ChallengeResponse(string password, byte[] challenge)
|
||||
: this()
|
||||
{
|
||||
this.Password = password;
|
||||
this.Challenge = challenge;
|
||||
}
|
||||
|
||||
// Token: 0x0600043A RID: 1082 RVA: 0x0001B3D0 File Offset: 0x000195D0
|
||||
~ChallengeResponse()
|
||||
{
|
||||
if (!this._disposed)
|
||||
{
|
||||
this.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F5 RID: 245
|
||||
// (get) Token: 0x0600043B RID: 1083 RVA: 0x0001B418 File Offset: 0x00019618
|
||||
// (set) Token: 0x0600043C RID: 1084 RVA: 0x0001B41C File Offset: 0x0001961C
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("too late");
|
||||
}
|
||||
DES des = DES.Create();
|
||||
des.Mode = CipherMode.ECB;
|
||||
if (value == null || value.Length < 1)
|
||||
{
|
||||
Buffer.BlockCopy(ChallengeResponse.nullEncMagic, 0, this._lmpwd, 0, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
des.Key = this.PasswordToKey(value, 0);
|
||||
ICryptoTransform cryptoTransform = des.CreateEncryptor();
|
||||
cryptoTransform.TransformBlock(ChallengeResponse.magic, 0, 8, this._lmpwd, 0);
|
||||
}
|
||||
if (value == null || value.Length < 8)
|
||||
{
|
||||
Buffer.BlockCopy(ChallengeResponse.nullEncMagic, 0, this._lmpwd, 8, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
des.Key = this.PasswordToKey(value, 7);
|
||||
ICryptoTransform cryptoTransform = des.CreateEncryptor();
|
||||
cryptoTransform.TransformBlock(ChallengeResponse.magic, 0, 8, this._lmpwd, 8);
|
||||
}
|
||||
MD4 md = MD4.Create();
|
||||
byte[] array = ((value != null) ? Encoding.Unicode.GetBytes(value) : new byte[0]);
|
||||
byte[] array2 = md.ComputeHash(array);
|
||||
Buffer.BlockCopy(array2, 0, this._ntpwd, 0, 16);
|
||||
Array.Clear(array, 0, array.Length);
|
||||
Array.Clear(array2, 0, array2.Length);
|
||||
des.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F6 RID: 246
|
||||
// (get) Token: 0x0600043D RID: 1085 RVA: 0x0001B550 File Offset: 0x00019750
|
||||
// (set) Token: 0x0600043E RID: 1086 RVA: 0x0001B554 File Offset: 0x00019754
|
||||
public byte[] Challenge
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("Challenge");
|
||||
}
|
||||
if (this._disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("too late");
|
||||
}
|
||||
this._challenge = (byte[])value.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F7 RID: 247
|
||||
// (get) Token: 0x0600043F RID: 1087 RVA: 0x0001B59C File Offset: 0x0001979C
|
||||
public byte[] LM
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("too late");
|
||||
}
|
||||
return this.GetResponse(this._lmpwd);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000F8 RID: 248
|
||||
// (get) Token: 0x06000440 RID: 1088 RVA: 0x0001B5CC File Offset: 0x000197CC
|
||||
public byte[] NT
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("too late");
|
||||
}
|
||||
return this.GetResponse(this._ntpwd);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000441 RID: 1089 RVA: 0x0001B5FC File Offset: 0x000197FC
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Token: 0x06000442 RID: 1090 RVA: 0x0001B60C File Offset: 0x0001980C
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (!this._disposed)
|
||||
{
|
||||
Array.Clear(this._lmpwd, 0, this._lmpwd.Length);
|
||||
Array.Clear(this._ntpwd, 0, this._ntpwd.Length);
|
||||
if (this._challenge != null)
|
||||
{
|
||||
Array.Clear(this._challenge, 0, this._challenge.Length);
|
||||
}
|
||||
this._disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000443 RID: 1091 RVA: 0x0001B674 File Offset: 0x00019874
|
||||
private byte[] GetResponse(byte[] pwd)
|
||||
{
|
||||
byte[] array = new byte[24];
|
||||
DES des = DES.Create();
|
||||
des.Mode = CipherMode.ECB;
|
||||
des.Key = this.PrepareDESKey(pwd, 0);
|
||||
ICryptoTransform cryptoTransform = des.CreateEncryptor();
|
||||
cryptoTransform.TransformBlock(this._challenge, 0, 8, array, 0);
|
||||
des.Key = this.PrepareDESKey(pwd, 7);
|
||||
cryptoTransform = des.CreateEncryptor();
|
||||
cryptoTransform.TransformBlock(this._challenge, 0, 8, array, 8);
|
||||
des.Key = this.PrepareDESKey(pwd, 14);
|
||||
cryptoTransform = des.CreateEncryptor();
|
||||
cryptoTransform.TransformBlock(this._challenge, 0, 8, array, 16);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000444 RID: 1092 RVA: 0x0001B70C File Offset: 0x0001990C
|
||||
private byte[] PrepareDESKey(byte[] key56bits, int position)
|
||||
{
|
||||
return new byte[]
|
||||
{
|
||||
key56bits[position],
|
||||
(byte)(((int)key56bits[position] << 7) | (key56bits[position + 1] >> 1)),
|
||||
(byte)(((int)key56bits[position + 1] << 6) | (key56bits[position + 2] >> 2)),
|
||||
(byte)(((int)key56bits[position + 2] << 5) | (key56bits[position + 3] >> 3)),
|
||||
(byte)(((int)key56bits[position + 3] << 4) | (key56bits[position + 4] >> 4)),
|
||||
(byte)(((int)key56bits[position + 4] << 3) | (key56bits[position + 5] >> 5)),
|
||||
(byte)(((int)key56bits[position + 5] << 2) | (key56bits[position + 6] >> 6)),
|
||||
(byte)(key56bits[position + 6] << 1)
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x06000445 RID: 1093 RVA: 0x0001B7A4 File Offset: 0x000199A4
|
||||
private byte[] PasswordToKey(string password, int position)
|
||||
{
|
||||
byte[] array = new byte[7];
|
||||
int num = Math.Min(password.Length - position, 7);
|
||||
Encoding.ASCII.GetBytes(password.ToUpper(CultureInfo.CurrentCulture), position, num, array, 0);
|
||||
byte[] array2 = this.PrepareDESKey(array, 0);
|
||||
Array.Clear(array, 0, array.Length);
|
||||
return array2;
|
||||
}
|
||||
|
||||
// Token: 0x040001F8 RID: 504
|
||||
private static byte[] magic = new byte[] { 75, 71, 83, 33, 64, 35, 36, 37 };
|
||||
|
||||
// Token: 0x040001F9 RID: 505
|
||||
private static byte[] nullEncMagic = new byte[] { 170, 211, 180, 53, 181, 20, 4, 238 };
|
||||
|
||||
// Token: 0x040001FA RID: 506
|
||||
private bool _disposed;
|
||||
|
||||
// Token: 0x040001FB RID: 507
|
||||
private byte[] _challenge;
|
||||
|
||||
// Token: 0x040001FC RID: 508
|
||||
private byte[] _lmpwd;
|
||||
|
||||
// Token: 0x040001FD RID: 509
|
||||
private byte[] _ntpwd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm
|
||||
{
|
||||
// Token: 0x02000077 RID: 119
|
||||
public abstract class MessageBase
|
||||
{
|
||||
// Token: 0x06000446 RID: 1094 RVA: 0x0001B7F8 File Offset: 0x000199F8
|
||||
protected MessageBase(int messageType)
|
||||
{
|
||||
this._type = messageType;
|
||||
}
|
||||
|
||||
// Token: 0x170000F9 RID: 249
|
||||
// (get) Token: 0x06000448 RID: 1096 RVA: 0x0001B820 File Offset: 0x00019A20
|
||||
// (set) Token: 0x06000449 RID: 1097 RVA: 0x0001B828 File Offset: 0x00019A28
|
||||
public NtlmFlags Flags
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._flags;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._flags = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FA RID: 250
|
||||
// (get) Token: 0x0600044A RID: 1098 RVA: 0x0001B834 File Offset: 0x00019A34
|
||||
public int Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600044B RID: 1099 RVA: 0x0001B83C File Offset: 0x00019A3C
|
||||
protected byte[] PrepareMessage(int messageSize)
|
||||
{
|
||||
byte[] array = new byte[messageSize];
|
||||
Buffer.BlockCopy(MessageBase.header, 0, array, 0, 8);
|
||||
array[8] = (byte)this._type;
|
||||
array[9] = (byte)(this._type >> 8);
|
||||
array[10] = (byte)(this._type >> 16);
|
||||
array[11] = (byte)(this._type >> 24);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600044C RID: 1100 RVA: 0x0001B894 File Offset: 0x00019A94
|
||||
protected virtual void Decode(byte[] message)
|
||||
{
|
||||
if (message == null)
|
||||
{
|
||||
throw new ArgumentNullException("message");
|
||||
}
|
||||
if (message.Length < 12)
|
||||
{
|
||||
string text = Locale.GetText("Minimum message length is 12 bytes.");
|
||||
throw new ArgumentOutOfRangeException("message", message.Length, text);
|
||||
}
|
||||
if (!this.CheckHeader(message))
|
||||
{
|
||||
string text2 = string.Format(Locale.GetText("Invalid Type{0} message."), this._type);
|
||||
throw new ArgumentException(text2, "message");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600044D RID: 1101 RVA: 0x0001B910 File Offset: 0x00019B10
|
||||
protected bool CheckHeader(byte[] message)
|
||||
{
|
||||
for (int i = 0; i < MessageBase.header.Length; i++)
|
||||
{
|
||||
if (message[i] != MessageBase.header[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (ulong)BitConverterLE.ToUInt32(message, 8) == (ulong)((long)this._type);
|
||||
}
|
||||
|
||||
// Token: 0x0600044E RID: 1102
|
||||
public abstract byte[] GetBytes();
|
||||
|
||||
// Token: 0x040001FE RID: 510
|
||||
private static byte[] header = new byte[] { 78, 84, 76, 77, 83, 83, 80, 0 };
|
||||
|
||||
// Token: 0x040001FF RID: 511
|
||||
private int _type;
|
||||
|
||||
// Token: 0x04000200 RID: 512
|
||||
private NtlmFlags _flags;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm
|
||||
{
|
||||
// Token: 0x02000078 RID: 120
|
||||
[Flags]
|
||||
public enum NtlmFlags
|
||||
{
|
||||
// Token: 0x04000202 RID: 514
|
||||
NegotiateUnicode = 1,
|
||||
// Token: 0x04000203 RID: 515
|
||||
NegotiateOem = 2,
|
||||
// Token: 0x04000204 RID: 516
|
||||
RequestTarget = 4,
|
||||
// Token: 0x04000205 RID: 517
|
||||
NegotiateNtlm = 512,
|
||||
// Token: 0x04000206 RID: 518
|
||||
NegotiateDomainSupplied = 4096,
|
||||
// Token: 0x04000207 RID: 519
|
||||
NegotiateWorkstationSupplied = 8192,
|
||||
// Token: 0x04000208 RID: 520
|
||||
NegotiateAlwaysSign = 32768,
|
||||
// Token: 0x04000209 RID: 521
|
||||
NegotiateNtlm2Key = 524288,
|
||||
// Token: 0x0400020A RID: 522
|
||||
Negotiate128 = 536870912,
|
||||
// Token: 0x0400020B RID: 523
|
||||
Negotiate56 = -2147483648
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm
|
||||
{
|
||||
// Token: 0x02000079 RID: 121
|
||||
public class Type1Message : MessageBase
|
||||
{
|
||||
// Token: 0x0600044F RID: 1103 RVA: 0x0001B958 File Offset: 0x00019B58
|
||||
public Type1Message()
|
||||
: base(1)
|
||||
{
|
||||
this._domain = Environment.UserDomainName;
|
||||
this._host = Environment.MachineName;
|
||||
base.Flags = NtlmFlags.NegotiateUnicode | NtlmFlags.NegotiateOem | NtlmFlags.NegotiateNtlm | NtlmFlags.NegotiateDomainSupplied | NtlmFlags.NegotiateWorkstationSupplied | NtlmFlags.NegotiateAlwaysSign;
|
||||
}
|
||||
|
||||
// Token: 0x06000450 RID: 1104 RVA: 0x0001B990 File Offset: 0x00019B90
|
||||
public Type1Message(byte[] message)
|
||||
: base(1)
|
||||
{
|
||||
this.Decode(message);
|
||||
}
|
||||
|
||||
// Token: 0x170000FB RID: 251
|
||||
// (get) Token: 0x06000451 RID: 1105 RVA: 0x0001B9A0 File Offset: 0x00019BA0
|
||||
// (set) Token: 0x06000452 RID: 1106 RVA: 0x0001B9A8 File Offset: 0x00019BA8
|
||||
public string Domain
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._domain;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._domain = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FC RID: 252
|
||||
// (get) Token: 0x06000453 RID: 1107 RVA: 0x0001B9B4 File Offset: 0x00019BB4
|
||||
// (set) Token: 0x06000454 RID: 1108 RVA: 0x0001B9BC File Offset: 0x00019BBC
|
||||
public string Host
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._host;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._host = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000455 RID: 1109 RVA: 0x0001B9C8 File Offset: 0x00019BC8
|
||||
protected override void Decode(byte[] message)
|
||||
{
|
||||
base.Decode(message);
|
||||
base.Flags = (NtlmFlags)BitConverterLE.ToUInt32(message, 12);
|
||||
int num = (int)BitConverterLE.ToUInt16(message, 16);
|
||||
int num2 = (int)BitConverterLE.ToUInt16(message, 20);
|
||||
this._domain = Encoding.ASCII.GetString(message, num2, num);
|
||||
int num3 = (int)BitConverterLE.ToUInt16(message, 24);
|
||||
this._host = Encoding.ASCII.GetString(message, 32, num3);
|
||||
}
|
||||
|
||||
// Token: 0x06000456 RID: 1110 RVA: 0x0001BA2C File Offset: 0x00019C2C
|
||||
public override byte[] GetBytes()
|
||||
{
|
||||
short num = (short)this._domain.Length;
|
||||
short num2 = (short)this._host.Length;
|
||||
byte[] array = base.PrepareMessage((int)(32 + num + num2));
|
||||
array[12] = (byte)base.Flags;
|
||||
array[13] = (byte)(base.Flags >> 8);
|
||||
array[14] = (byte)(base.Flags >> 16);
|
||||
array[15] = (byte)(base.Flags >> 24);
|
||||
short num3 = 32 + num2;
|
||||
array[16] = (byte)num;
|
||||
array[17] = (byte)(num >> 8);
|
||||
array[18] = array[16];
|
||||
array[19] = array[17];
|
||||
array[20] = (byte)num3;
|
||||
array[21] = (byte)(num3 >> 8);
|
||||
array[24] = (byte)num2;
|
||||
array[25] = (byte)(num2 >> 8);
|
||||
array[26] = array[24];
|
||||
array[27] = array[25];
|
||||
array[28] = 32;
|
||||
array[29] = 0;
|
||||
byte[] bytes = Encoding.ASCII.GetBytes(this._host.ToUpper(CultureInfo.InvariantCulture));
|
||||
Buffer.BlockCopy(bytes, 0, array, 32, bytes.Length);
|
||||
byte[] bytes2 = Encoding.ASCII.GetBytes(this._domain.ToUpper(CultureInfo.InvariantCulture));
|
||||
Buffer.BlockCopy(bytes2, 0, array, (int)num3, bytes2.Length);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0400020C RID: 524
|
||||
private string _host;
|
||||
|
||||
// Token: 0x0400020D RID: 525
|
||||
private string _domain;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm
|
||||
{
|
||||
// Token: 0x0200007A RID: 122
|
||||
public class Type2Message : MessageBase
|
||||
{
|
||||
// Token: 0x06000457 RID: 1111 RVA: 0x0001BB48 File Offset: 0x00019D48
|
||||
public Type2Message()
|
||||
: base(2)
|
||||
{
|
||||
this._nonce = new byte[8];
|
||||
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
|
||||
randomNumberGenerator.GetBytes(this._nonce);
|
||||
base.Flags = NtlmFlags.NegotiateUnicode | NtlmFlags.NegotiateNtlm | NtlmFlags.NegotiateAlwaysSign;
|
||||
}
|
||||
|
||||
// Token: 0x06000458 RID: 1112 RVA: 0x0001BB88 File Offset: 0x00019D88
|
||||
public Type2Message(byte[] message)
|
||||
: base(2)
|
||||
{
|
||||
this._nonce = new byte[8];
|
||||
this.Decode(message);
|
||||
}
|
||||
|
||||
// Token: 0x06000459 RID: 1113 RVA: 0x0001BBA4 File Offset: 0x00019DA4
|
||||
~Type2Message()
|
||||
{
|
||||
if (this._nonce != null)
|
||||
{
|
||||
Array.Clear(this._nonce, 0, this._nonce.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FD RID: 253
|
||||
// (get) Token: 0x0600045A RID: 1114 RVA: 0x0001BBF8 File Offset: 0x00019DF8
|
||||
// (set) Token: 0x0600045B RID: 1115 RVA: 0x0001BC0C File Offset: 0x00019E0C
|
||||
public byte[] Nonce
|
||||
{
|
||||
get
|
||||
{
|
||||
return (byte[])this._nonce.Clone();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("Nonce");
|
||||
}
|
||||
if (value.Length != 8)
|
||||
{
|
||||
string text = Locale.GetText("Invalid Nonce Length (should be 8 bytes).");
|
||||
throw new ArgumentException(text, "Nonce");
|
||||
}
|
||||
this._nonce = (byte[])value.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600045C RID: 1116 RVA: 0x0001BC5C File Offset: 0x00019E5C
|
||||
protected override void Decode(byte[] message)
|
||||
{
|
||||
base.Decode(message);
|
||||
base.Flags = (NtlmFlags)BitConverterLE.ToUInt32(message, 20);
|
||||
Buffer.BlockCopy(message, 24, this._nonce, 0, 8);
|
||||
}
|
||||
|
||||
// Token: 0x0600045D RID: 1117 RVA: 0x0001BC90 File Offset: 0x00019E90
|
||||
public override byte[] GetBytes()
|
||||
{
|
||||
byte[] array = base.PrepareMessage(40);
|
||||
short num = (short)array.Length;
|
||||
array[16] = (byte)num;
|
||||
array[17] = (byte)(num >> 8);
|
||||
array[20] = (byte)base.Flags;
|
||||
array[21] = (byte)(base.Flags >> 8);
|
||||
array[22] = (byte)(base.Flags >> 16);
|
||||
array[23] = (byte)(base.Flags >> 24);
|
||||
Buffer.BlockCopy(this._nonce, 0, array, 24, this._nonce.Length);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0400020E RID: 526
|
||||
private byte[] _nonce;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Security.Protocol.Ntlm
|
||||
{
|
||||
// Token: 0x0200007B RID: 123
|
||||
public class Type3Message : MessageBase
|
||||
{
|
||||
// Token: 0x0600045E RID: 1118 RVA: 0x0001BD08 File Offset: 0x00019F08
|
||||
public Type3Message()
|
||||
: base(3)
|
||||
{
|
||||
this._domain = Environment.UserDomainName;
|
||||
this._host = Environment.MachineName;
|
||||
this._username = Environment.UserName;
|
||||
base.Flags = NtlmFlags.NegotiateUnicode | NtlmFlags.NegotiateNtlm | NtlmFlags.NegotiateAlwaysSign;
|
||||
}
|
||||
|
||||
// Token: 0x0600045F RID: 1119 RVA: 0x0001BD40 File Offset: 0x00019F40
|
||||
public Type3Message(byte[] message)
|
||||
: base(3)
|
||||
{
|
||||
this.Decode(message);
|
||||
}
|
||||
|
||||
// Token: 0x06000460 RID: 1120 RVA: 0x0001BD50 File Offset: 0x00019F50
|
||||
~Type3Message()
|
||||
{
|
||||
if (this._challenge != null)
|
||||
{
|
||||
Array.Clear(this._challenge, 0, this._challenge.Length);
|
||||
}
|
||||
if (this._lm != null)
|
||||
{
|
||||
Array.Clear(this._lm, 0, this._lm.Length);
|
||||
}
|
||||
if (this._nt != null)
|
||||
{
|
||||
Array.Clear(this._nt, 0, this._nt.Length);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FE RID: 254
|
||||
// (get) Token: 0x06000461 RID: 1121 RVA: 0x0001BDE4 File Offset: 0x00019FE4
|
||||
// (set) Token: 0x06000462 RID: 1122 RVA: 0x0001BE04 File Offset: 0x0001A004
|
||||
public byte[] Challenge
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._challenge == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (byte[])this._challenge.Clone();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("Challenge");
|
||||
}
|
||||
if (value.Length != 8)
|
||||
{
|
||||
string text = Locale.GetText("Invalid Challenge Length (should be 8 bytes).");
|
||||
throw new ArgumentException(text, "Challenge");
|
||||
}
|
||||
this._challenge = (byte[])value.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000FF RID: 255
|
||||
// (get) Token: 0x06000463 RID: 1123 RVA: 0x0001BE54 File Offset: 0x0001A054
|
||||
// (set) Token: 0x06000464 RID: 1124 RVA: 0x0001BE5C File Offset: 0x0001A05C
|
||||
public string Domain
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._domain;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._domain = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000100 RID: 256
|
||||
// (get) Token: 0x06000465 RID: 1125 RVA: 0x0001BE68 File Offset: 0x0001A068
|
||||
// (set) Token: 0x06000466 RID: 1126 RVA: 0x0001BE70 File Offset: 0x0001A070
|
||||
public string Host
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._host;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._host = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000101 RID: 257
|
||||
// (get) Token: 0x06000467 RID: 1127 RVA: 0x0001BE7C File Offset: 0x0001A07C
|
||||
// (set) Token: 0x06000468 RID: 1128 RVA: 0x0001BE84 File Offset: 0x0001A084
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._password;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._password = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000102 RID: 258
|
||||
// (get) Token: 0x06000469 RID: 1129 RVA: 0x0001BE90 File Offset: 0x0001A090
|
||||
// (set) Token: 0x0600046A RID: 1130 RVA: 0x0001BE98 File Offset: 0x0001A098
|
||||
public string Username
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._username;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._username = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000103 RID: 259
|
||||
// (get) Token: 0x0600046B RID: 1131 RVA: 0x0001BEA4 File Offset: 0x0001A0A4
|
||||
public byte[] LM
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._lm;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000104 RID: 260
|
||||
// (get) Token: 0x0600046C RID: 1132 RVA: 0x0001BEAC File Offset: 0x0001A0AC
|
||||
public byte[] NT
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._nt;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600046D RID: 1133 RVA: 0x0001BEB4 File Offset: 0x0001A0B4
|
||||
protected override void Decode(byte[] message)
|
||||
{
|
||||
base.Decode(message);
|
||||
if ((int)BitConverterLE.ToUInt16(message, 56) != message.Length)
|
||||
{
|
||||
string text = Locale.GetText("Invalid Type3 message length.");
|
||||
throw new ArgumentException(text, "message");
|
||||
}
|
||||
this._password = null;
|
||||
int num = (int)BitConverterLE.ToUInt16(message, 28);
|
||||
int num2 = 64;
|
||||
this._domain = Encoding.Unicode.GetString(message, num2, num);
|
||||
int num3 = (int)BitConverterLE.ToUInt16(message, 44);
|
||||
int num4 = (int)BitConverterLE.ToUInt16(message, 48);
|
||||
this._host = Encoding.Unicode.GetString(message, num4, num3);
|
||||
int num5 = (int)BitConverterLE.ToUInt16(message, 36);
|
||||
int num6 = (int)BitConverterLE.ToUInt16(message, 40);
|
||||
this._username = Encoding.Unicode.GetString(message, num6, num5);
|
||||
this._lm = new byte[24];
|
||||
int num7 = (int)BitConverterLE.ToUInt16(message, 16);
|
||||
Buffer.BlockCopy(message, num7, this._lm, 0, 24);
|
||||
this._nt = new byte[24];
|
||||
int num8 = (int)BitConverterLE.ToUInt16(message, 24);
|
||||
Buffer.BlockCopy(message, num8, this._nt, 0, 24);
|
||||
if (message.Length >= 64)
|
||||
{
|
||||
base.Flags = (NtlmFlags)BitConverterLE.ToUInt32(message, 60);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600046E RID: 1134 RVA: 0x0001BFD0 File Offset: 0x0001A1D0
|
||||
public override byte[] GetBytes()
|
||||
{
|
||||
byte[] bytes = Encoding.Unicode.GetBytes(this._domain.ToUpper(CultureInfo.InvariantCulture));
|
||||
byte[] bytes2 = Encoding.Unicode.GetBytes(this._username);
|
||||
byte[] bytes3 = Encoding.Unicode.GetBytes(this._host.ToUpper(CultureInfo.InvariantCulture));
|
||||
byte[] array = base.PrepareMessage(64 + bytes.Length + bytes2.Length + bytes3.Length + 24 + 24);
|
||||
short num = (short)(64 + bytes.Length + bytes2.Length + bytes3.Length);
|
||||
array[12] = 24;
|
||||
array[13] = 0;
|
||||
array[14] = 24;
|
||||
array[15] = 0;
|
||||
array[16] = (byte)num;
|
||||
array[17] = (byte)(num >> 8);
|
||||
short num2 = num + 24;
|
||||
array[20] = 24;
|
||||
array[21] = 0;
|
||||
array[22] = 24;
|
||||
array[23] = 0;
|
||||
array[24] = (byte)num2;
|
||||
array[25] = (byte)(num2 >> 8);
|
||||
short num3 = (short)bytes.Length;
|
||||
short num4 = 64;
|
||||
array[28] = (byte)num3;
|
||||
array[29] = (byte)(num3 >> 8);
|
||||
array[30] = array[28];
|
||||
array[31] = array[29];
|
||||
array[32] = (byte)num4;
|
||||
array[33] = (byte)(num4 >> 8);
|
||||
short num5 = (short)bytes2.Length;
|
||||
short num6 = num4 + num3;
|
||||
array[36] = (byte)num5;
|
||||
array[37] = (byte)(num5 >> 8);
|
||||
array[38] = array[36];
|
||||
array[39] = array[37];
|
||||
array[40] = (byte)num6;
|
||||
array[41] = (byte)(num6 >> 8);
|
||||
short num7 = (short)bytes3.Length;
|
||||
short num8 = num6 + num5;
|
||||
array[44] = (byte)num7;
|
||||
array[45] = (byte)(num7 >> 8);
|
||||
array[46] = array[44];
|
||||
array[47] = array[45];
|
||||
array[48] = (byte)num8;
|
||||
array[49] = (byte)(num8 >> 8);
|
||||
short num9 = (short)array.Length;
|
||||
array[56] = (byte)num9;
|
||||
array[57] = (byte)(num9 >> 8);
|
||||
array[60] = (byte)base.Flags;
|
||||
array[61] = (byte)(base.Flags >> 8);
|
||||
array[62] = (byte)(base.Flags >> 16);
|
||||
array[63] = (byte)(base.Flags >> 24);
|
||||
Buffer.BlockCopy(bytes, 0, array, (int)num4, bytes.Length);
|
||||
Buffer.BlockCopy(bytes2, 0, array, (int)num6, bytes2.Length);
|
||||
Buffer.BlockCopy(bytes3, 0, array, (int)num8, bytes3.Length);
|
||||
using (ChallengeResponse challengeResponse = new ChallengeResponse(this._password, this._challenge))
|
||||
{
|
||||
Buffer.BlockCopy(challengeResponse.LM, 0, array, (int)num, 24);
|
||||
Buffer.BlockCopy(challengeResponse.NT, 0, array, (int)num2, 24);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0400020F RID: 527
|
||||
private byte[] _challenge;
|
||||
|
||||
// Token: 0x04000210 RID: 528
|
||||
private string _host;
|
||||
|
||||
// Token: 0x04000211 RID: 529
|
||||
private string _domain;
|
||||
|
||||
// Token: 0x04000212 RID: 530
|
||||
private string _username;
|
||||
|
||||
// Token: 0x04000213 RID: 531
|
||||
private string _password;
|
||||
|
||||
// Token: 0x04000214 RID: 532
|
||||
private byte[] _lm;
|
||||
|
||||
// Token: 0x04000215 RID: 533
|
||||
private byte[] _nt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user