|
using System;
using ProjectName.Network.Cryptography;
using System.Text;
namespace ProjectName.Network.AuthPackets
{
public class Authentication
{
byte[] Buffer;
public string Username
{
get
{
string x = Encoding.Default.GetString(Buffer, 8, 32);
return x.Replace("\0", "");
}
}
public string Password
{
get
{
byte[] PasswordArray = Encoding.Default.GetBytes(Encoding.Default.GetString(Buffer, 84, 32).Replace("\0", ""));
string x = ProjectName.Network.Cryptography.PasswordDecryption.Decrypt(PasswordArray);
return x.Replace("\0", "");
}
}
public string Server
{
get
{
string x = Encoding.Default.GetString(Buffer, 136, 16);
return x.Replace("\0", "").Replace("0", "");
}
}
public string MacAddress
{
get
{
string x = Encoding.Default.GetString(Buffer, 152, 16);
return x.Replace("\0", "");
}
}
public void Deserialize(byte[] buffer)
{
if (buffer.Length == 312)
{
ushort length = BitConverter.ToUInt16(buffer, 0);
if (length == 312)
{
ushort type = BitConverter.ToUInt16(buffer, 2);
if (type == 1636)
{
Buffer = buffer;
}
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectName.Network.Cryptography
{
using System.Text;
public class PasswordDecryption
{
static byte[] Key = new byte[32] { 90, 45, 12, 17, 35, 66, 44, 1, 02, 41, 59, 32, 36, 2, 234, 1, 10, 2, 79, 73, 202, 31, 99, 75, 7, 34, 16, 35, 101, 226, 99, 152 };
public static string Decrypt(byte[] data)
{
int length = Key.Length;
for (int x = 0; x < data.Length; x++)
{
data[x] ^= Key[x % length];
data[x] ^= Key[(x * 24 % 16) % length];
data[x] ^= Key[(x * 48 % 32) % length];
}
return Encoding.Default.GetString(data);
}
}
}
public static void AuthServer_OnClientReceive(byte[] buffer, int length, ClientWrapper arg3)
{
var player = arg3.Connector as Client.AuthClient;
player.Cryptographer.Decrypt(buffer, length);
player.Queue.Enqueue(buffer, length);
while (player.Queue.CanDequeue())
{
byte[] packet = player.Queue.Dequeue();
ushort len = BitConverter.ToUInt16(packet, 0);
ushort id = BitConverter.ToUInt16(packet, 2);
if (len == 312)
{
player.Info = new ProjectName.Network.AuthPackets.Authentication();
player.Info.Deserialize(packet);
player.Account = new AccountTable(player.Info.Username);
msvcrt.msvcrt.srand(player.PasswordSeed);
Forward Fw = new Forward();
if (player.Account.Password == player.Info.Password && player.Account.exists)
Fw.Type = Forward.ForwardType.Ready;
else
Fw.Type = Forward.ForwardType.InvalidInfo;
if (Fw.Type == Network.AuthPackets.Forward.ForwardType.Ready)
{
Fw.Identifier = player.Account.GenerateKey();
Kernel.AwaitingPool[Fw.Identifier] = player.Account;
Fw.IP = Program.GameIP;
Fw.Port = Program.GamePort;
}
player.Send(Fw);
}
}
}
الذين يشاهدون محتوى الموضوع الآن : 4 ( الأعضاء 0 والزوار 4) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
حصريا لودر 5517 محمي 100% | xAttack | البرامج والودرات | 68 | اليوم 09:11 PM |
سيستم اقوي لودر حمايه لودر [XMeGo] | Mahmoud | البرامج والودرات | 305 | 2024-08-11 06:40 PM |
حصريا علي منتدي اكواد اقوي اتوباتش | محمد ياسر | تطوير سيرفرات كونكر | 71 | 2024-08-10 01:17 PM |
لودر 2d محمي كامل | AhmedGadd | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2024-04-08 03:28 AM |
خلي الكينج الاول اقوي من الثاني والثاني اقوي من الثالث وهكذا | محمد ياسر | تطوير سيرفرات كونكر | 5 | 2023-07-22 01:47 AM |