public byte[] GetBytes(byte[] data, int count = 64) { if (data.Length > count) { goto IL_2A; } IL_06: int arg_10_0 = -1099893497; IL_0B: byte[] array; switch ((arg_10_0 ^ -1023563484) % 4) { case 0: goto IL_06; case 2: IL_2A: array = new byte[count]; arg_10_0 = -1371147539; goto IL_0B; case 3: return(data); } SRP6a.smethod_11(data, 0, array, 0, 64); return(array); }
public static void CreateAccount(string[] args) { var email = Command.Read<string>(args, 0); var password = Command.Read<string>(args, 1); if (email != null && password != null) { var salt = new byte[0].GenerateRandomKey(0x20).ToHexString(); var result = DB.Auth.Any<Account>(a => a.Email == email); if (!result) { var srp = new SRP6a(salt); srp.CalculateX(email, password.ToUpper(), false); var account = new Account { Email = email, PasswordVerifier = srp.V.ToHexString(), Salt = salt, Region = Regions.XX, }; if (DB.Auth.Add(account)) Log.Message(LogType.Normal, "Account {0} successfully created", email); } else Log.Message(LogType.Error, "Account {0} already in database", email); } }
public void CalculateX(string accountName, string password, bool calcB) { this.I = SRP6a.smethod_3(this.sha256, SRP6a.smethod_2(SRP6a.smethod_1(), accountName)); while (true) { IL_A7: uint arg_8F_0 = 2553222655u; while (true) { uint num; switch ((num = (arg_8F_0 ^ 2695648094u)) % 3u) { case 0u: goto IL_A7; case 1u: { byte[] data = SRP6a.smethod_3(this.sha256, SRP6a.smethod_2(SRP6a.smethod_1(), SRP6a.smethod_6(this.I.ToHexString(), Module.smethod_33 <string>(1968828782u), SRP6a.smethod_5(password)))); BigInteger x = this.MakeBigInteger(SRP6a.smethod_3(this.sha256, this.S.Combine(data))); this.CalculateV(x, calcB); arg_8F_0 = (num * 1788205373u ^ 735249050u); continue; } } return; } } }
public SRP6a(string salt, string accountName = "", string passwordVerifier = "") { while (true) { IL_11A: uint arg_FA_0 = 1990870343u; while (true) { uint num; switch ((num = (arg_FA_0 ^ 1565948384u)) % 5u) { case 0u: this.k = this.MakeBigInteger(SRP6a.smethod_3(this.sha256, this.N.Combine(this.g))); this.v = this.MakeBigInteger(passwordVerifier.ToByteArray()); arg_FA_0 = (num * 10374198u ^ 3275431934u); continue; case 1u: this.S = salt.ToByteArray(); this.g = new byte[] { 2 }; this.BN = this.MakeBigInteger(this.N); this.gBN = this.MakeBigInteger(this.g); arg_FA_0 = (num * 4125876422u ^ 2637048811u); continue; case 2u: { this.sha256 = SRP6a.smethod_0(); this.I = SRP6a.smethod_3(this.sha256, SRP6a.smethod_2(SRP6a.smethod_1(), accountName)); byte[] expr_3D = new byte[128]; SRP6a.smethod_4(expr_3D, fieldof(Framework.< PrivateImplementationDetails >.struct15_3).FieldHandle); this.N = expr_3D; arg_FA_0 = (num * 2174447120u ^ 1530330669u); continue; } case 3u: goto IL_11A; } return; } } }
public static void CreateAccount(string[] args) { var email = Helper.Read<string>(args, 0); var loginName = Helper.Read<string>(args, 1); var password = Helper.Read<string>(args, 2); if (email != null && password != null && loginName != null) { var salt = Helper.GenerateRandomKey(8).ToHexString(); var result = DB.Auth.Any<Account>(a => a.Email == email || a.LoginName == loginName); if (!result) { var srp = new SRP6a(salt); srp.CalculateX(email, password, false); var account = new Account { Email = email, LoginName = loginName, PasswordVerifier = srp.V.ToHexString(), Salt = salt }; var accountId = DB.Auth.GetAutoIncrementValue<Account, uint>(); var gameAccountId = DB.Auth.GetAutoIncrementValue<GameAccount, uint>(); var gameAccount = new GameAccount { AccountId = accountId, Alias = $"{accountId}#{gameAccountId}", }; if (DB.Auth.Add(account) && DB.Auth.Add(gameAccount)) Console.WriteLine($"Account 'Email: {email}, LoginName: {loginName}' successfully created."); } else Console.WriteLine($"Account 'Email: {email}' or 'LoginName: {loginName}' already in database."); } }
public void CalculateU(byte[] a) { this.A = this.MakeBigInteger(a); while (true) { IL_5C: uint arg_44_0 = 1038568804u; while (true) { uint num; switch ((num = (arg_44_0 ^ 1653931647u)) % 3u) { case 0u: goto IL_5C; case 2u: this.CalculateS(this.MakeBigInteger(SRP6a.smethod_3(this.sha256, a.Combine(this.B)))); arg_44_0 = (num * 3059919140u ^ 4120859160u); continue; } return; } } }
public void CalculateB() { byte[] array = new byte[128]; while (true) { IL_7C: uint arg_5C_0 = 3206230607u; while (true) { uint num; switch ((num = (arg_5C_0 ^ 2218348064u)) % 5u) { case 0u: this.S2 = array; arg_5C_0 = (num * 3988362356u ^ 2556367054u); continue; case 1u: this.b = this.MakeBigInteger(array); arg_5C_0 = (num * 3278302294u ^ 3633323988u); continue; case 3u: SRP6a.smethod_8(SRP6a.smethod_7(), array); arg_5C_0 = (num * 2572586182u ^ 1454878351u); continue; case 4u: goto IL_7C; } goto Block_1; } } Block_1: this.B = this.GetBytes(((this.k * this.v + BigInteger.ModPow(this.gBN, this.b, this.BN)) % this.BN).ToByteArray(), 128); }
public static void Create(string[] args) { var email = Command.Read<string>(args, 0); var password = Command.Read<string>(args, 1); if (email != null && password != null) { var salt = new byte[0].GenerateRandomKey(0x20).ToHexString(); var result = DB.Auth.Accounts.Any(a => a.Email.Equals(email)); if (!result) { var srp = new SRP6a(salt); srp.CalculateX(email, password.ToUpper(), false); var account = new Account { Email = email, PasswordVerifier = srp.V.ToHexString(), Salt = salt, Region = "XX", Expansion = 5 }; if (DB.Auth.Add(account)) { // Default class/expansion data (sent in AuthResponse) var defaultAllowedClasses = new byte[,] { { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 }, { 6, 2 }, { 7, 0 }, { 8, 0 }, { 9, 0 }, { 10, 4 }, { 11, 0 } }; // Default race/expansion data (sent in AuthResponse) var defaultAllowedRaces = new byte[,] { { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 }, { 6, 0 }, { 7, 0 }, { 8, 0 }, { 9, 3 }, { 10, 1 }, { 11, 1 }, { 22, 3 }, { 24, 4 }, { 25, 4 }, { 26, 4 }}; for (int i = 0; i < defaultAllowedClasses.Length / 2; i++) { DB.Auth.Add(new AllowedClass { AccountId = account.Id, Class = defaultAllowedClasses[i, 0], Expansion = defaultAllowedClasses[i, 1] }); } for (int i = 0; i < defaultAllowedRaces.Length / 2; i++) { DB.Auth.Add(new AllowedRace { AccountId = account.Id, Race = defaultAllowedRaces[i, 0], Expansion = defaultAllowedRaces[i, 1] }); } Log.Message(LogType.Normal, "Account {0} successfully created", email); } } else Log.Message(LogType.Error, "Account {0} already in database", email); } }
public void CalculateClientM(byte[] a) { byte[] array = SRP6a.smethod_3(this.sha256, this.N); while (true) { IL_140: uint arg_113_0 = 2564275220u; while (true) { uint num; switch ((num = (arg_113_0 ^ 3263938703u)) % 8u) { case 0u: goto IL_140; case 1u: { byte[] byte_ = array.Combine(SRP6a.smethod_3(this.sha256, SRP6a.smethod_2(SRP6a.smethod_1(), this.I.ToHexString()))).Combine(this.S).Combine(a).Combine(this.B).Combine(this.SessionKey); this.ClientM = SRP6a.smethod_3(this.sha256, byte_); arg_113_0 = (num * 1130404651u ^ 272827307u); continue; } case 2u: { int num2; arg_113_0 = ((num2 < array.Length) ? 2194615946u : 2393073750u); continue; } case 3u: { byte[] array2 = SRP6a.smethod_3(this.sha256, this.g); arg_113_0 = (num * 3484930294u ^ 4152190963u); continue; } case 4u: { int num2; num2++; arg_113_0 = (num * 1293311391u ^ 2582903929u); continue; } case 5u: { byte[] expr_33_cp_0 = array; int num2; int expr_33_cp_1 = num2; byte[] array2; expr_33_cp_0[expr_33_cp_1] ^= array2[num2]; arg_113_0 = 3974963915u; continue; } case 6u: { int num2 = 0; arg_113_0 = (num * 1672443058u ^ 2395775225u); continue; } } return; } } }
public void CalculateWoWSessionKey(byte[] arr) { while (true) { IL_1F8: uint arg_1A6_0 = 57912216u; while (true) { uint num; switch ((num = (arg_1A6_0 ^ 1862494343u)) % 17u) { case 0u: { byte[] array = new byte[arr.Length / 2]; arg_1A6_0 = (num * 598141279u ^ 3709953262u); continue; } case 1u: { byte[] array2 = SRP6a.smethod_10(SRP6a.smethod_9(), array2); byte[] array = SRP6a.smethod_10(SRP6a.smethod_9(), array); arg_1A6_0 = (num * 3150643284u ^ 2166396056u); continue; } case 2u: { byte[] array2; int num2; this.WoWSessionKey[num2 * 2] = array2[num2]; arg_1A6_0 = 2098472953u; continue; } case 3u: { byte[] array2; int num3; array2[num3] = arr[num3 * 2]; arg_1A6_0 = 472270212u; continue; } case 4u: { byte[] array2 = new byte[arr.Length / 2]; arg_1A6_0 = (num * 4031285479u ^ 4201713760u); continue; } case 5u: arg_1A6_0 = (num * 4069555469u ^ 1090867220u); continue; case 6u: { int num3; num3++; arg_1A6_0 = (num * 428409243u ^ 3952092863u); continue; } case 7u: { byte[] array2; int num3; arg_1A6_0 = ((num3 >= array2.Length) ? 435006772u : 552065601u); continue; } case 8u: { byte[] array; int num2; this.WoWSessionKey[num2 * 2 + 1] = array[num2]; arg_1A6_0 = (num * 1049171215u ^ 159242650u); continue; } case 9u: { int num2; num2++; arg_1A6_0 = (num * 2545200484u ^ 1484258480u); continue; } case 10u: { byte[] array; byte[] array2; this.WoWSessionKey = new byte[array2.Length + array.Length]; arg_1A6_0 = (num * 2279781675u ^ 167724743u); continue; } case 11u: { int num3 = 0; arg_1A6_0 = (num * 2477893337u ^ 1881340740u); continue; } case 12u: { byte[] array2; int num2; arg_1A6_0 = ((num2 < array2.Length) ? 460778666u : 814051148u); continue; } case 13u: { byte[] array; int num3; array[num3] = arr[num3 * 2 + 1]; arg_1A6_0 = (num * 3568307509u ^ 907486368u); continue; } case 15u: { int num2 = 0; arg_1A6_0 = (num * 1158626221u ^ 382197970u); continue; } case 16u: goto IL_1F8; } return; } } }
public void Dispose() { client = null; Account = null; SecureRemotePassword = null; }