|
|
المشاركات 201 |
+التقييم 0.11 |
تاريخ التسجيل Oct 2019 |
الاقامة Egypt |
نظام التشغيل 8.1 |
رقم العضوية 2274 |
Protection.LoaderProgram.Init();
#region GameServer|AuthServer
#region GameServer|AuthServer
private static void GameServer_OnClientReceive(byte[] buffer, int length, ClientWrapper obj)
{
if (obj.Connector == null)
{
obj.Disconnect();
}
else
{
GameState connector = obj.Connector as GameState;
if (connector.Exchange)
{
connector.Exchange = false;
connector.Action = (byte)1;
EgyXos.Network.Cryptography.GameCryptography gameCryptography = new EgyXos.Network.Cryptography.GameCryptography(Encoding.Default.GetBytes(Constants.GameCryptographyKey));
byte[] numArray = new byte[length];
Array.Copy((Array)buffer, (Array)numArray, length);
gameCryptography.Decrypt(numArray, length);
bool flag = false;
int offset = 0;
for (int x = 0; x < 80; x++)
{
if (BitConverter.ToInt32(numArray, x) == 128)
{
if (length >= 205)
{
offset = x;
flag = true;
connector.Cryptography.Decrypt(buffer, length - 40);
}
else
{
offset = x;
connector.Cryptography.Decrypt(buffer, length);
}
}
}
int int32 = BitConverter.ToInt32(buffer, offset);
int index1 = offset + 4;
if (int32 != 128)
{
connector.Disconnect(true);
}
else
{
byte[] bytes = new byte[128];
int index2 = 0;
while (index2 < int32)
{
bytes[index2] = buffer[index1];
++index2;
++index1;
}
string PublicKey = Encoding.Default.GetString(bytes);
connector.Cryptography = connector.DHKeyExchange.HandleClientKeyPacket(PublicKey, connector.Cryptography);
if (!flag)
return;
byte[] buffer1 = new byte[40];
Buffer.BlockCopy((Array)buffer, length - 40, (Array)buffer1, 0, 40);
processData(buffer1, 40, connector);
}
}
else
processData(buffer, length, connector);
}
}
private static void processData(byte[] buffer, int length, Client.GameState Client)
{
Client.Cryptography.Decrypt(buffer, length);
Client.Queue.Enqueue(buffer, length);
if (Client.Queue.CurrentLength > 1224)
{
Console.WriteLine("[Disconnect]Reason:The packet size is too big. " + Client.Queue.CurrentLength);
Client.Disconnect();
return;
}
while (Client.Queue.CanDequeue())
{
byte[] data = Client.Queue.Dequeue();
Network.PacketHandler.HandlePacket(data, Client);
}
}
static void GameServer_OnClientConnect(ClientWrapper obj)
{
Client.GameState client = new Client.GameState(obj);
client.Send(client.DHKeyExchange.CreateServerKeyPacket());
obj.Connector = client;
}
static void GameServer_OnClientDisconnect(ClientWrapper obj)
{
if (obj.Connector != null)
(obj.Connector as Client.GameState).Disconnect();
else
obj.Disconnect();
}
public static void AuthServer_OnClientReceive(byte[] buffer, int length, ClientWrapper arg3)
{
var player = arg3.Connector as Client.AuthClient;
AuthClient authClient = arg3.Connector as 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);
if (len == 312)
{
player.Info = new EgyXos.Network.AuthPackets.Authentication();
player.Info.Deserialize(packet);
player.Account = new AccountTable(player.Info.Username);
if (!LoginBruteForce.AcceptJoin(arg3.IP))
{
Console.WriteLine(string.Concat(new string[] { "Client > ", player.Info.Username, "was blocked address", arg3.IP, "!" }));
arg3.Disconnect();
break;
}
Forward Fw = new Forward();
//Console.WriteLine("UserName: {0} Password: {1} ServerName: {2} Online", player.Info.Username, player.Info.Password, player.Info.Server);
if (player.Account.Username == player.Info.Username && player.Account.exists)
{
if (player.Account.Password == player.Info.Password && player.Account.exists)
{
Fw.Identifier = player.Account.GenerateKey();
Kernel.AwaitingPool[Fw.Identifier] = player.Account;
Fw.IP = GameIP;
Fw.Port = GamePort;
}
else
{
LoginBruteForce.ClientRegistred(arg3.IP);
Fw.Type = Forward.ForwardType.InvalidInfo;
}
}
else
{
Fw.Type = Forward.ForwardType.WrongAccount;
}
player.Send(Fw);
}
}
}
static void AuthServer_OnClientDisconnect(ClientWrapper obj)
{
obj.Disconnect();
}
static void AuthServer_OnClientConnect(ClientWrapper obj)
{
Client.AuthClient authState;
obj.Connector = (authState = new Client.AuthClient(obj));
authState.Cryptographer = new Network.Cryptography.AuthCryptography();
Network.AuthPackets.PasswordCryptographySeed pcs = new PasswordCryptographySeed();
pcs.Seed = Kernel.Random.Next();
authState.PasswordSeed = pcs.Seed;
authState.Send(pcs);
// Protection.LoaderProgram.CLientsPass.Clear();////////
//Protection.LoaderProgram.CLientsPass.Add(authState.PasswordSeed, "");
}
internal static Client.GameState FindClient(string name)
{
return GamePool.FirstOrDefault(p => p.Entity.LoweredName == name);
}
#endregion
public GameState(ClientWrapper socket)
public GameState(ClientWrapper socket)
{
Fake = socket == null;
Queue = new ConcurrentPacketQueue();
PacketFilter = new PacketFilter() { { 10010, 10 }, { 10005, 7 }, { 2064, 4 }, { 2032, 3 }, { 1027, 2 } };
Attackable = false;
Action = 0;
_socket = socket;
ExtraStatus = new System.Collections.Concurrent.ConcurrentDictionary<Role.Instance.RoleStatus.StatuTyp, Role.Instance.RoleStatus>();
// Cryptography = new GameCryptography(Program.Encoding.GetBytes(AuthServer.GameLogginKeyServer));
Cryptography = new GameCryptography(Program.Encoding.GetBytes(Constants.GameCryptographyKey));
DHKeyExchange = new Network.GamePackets.DHKeyExchange.ServerKeyExchange();
//SpiritBeadQ = new Game.Features.SpiritBeadQuest(this);
ChiPowers = new List<ChiPowerStructure>();
Retretead_ChiPowers = new ChiPowerStructure[4];
//JiangPowers = new List<JiangPowerStructure>();
}
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
[منقول للافادة] New Sourc 3d Porto | Mostafa Shalby | سورسات كونكر | 73 | 2024-10-17 11:34 AM |
شرح تشغيل سورس بدون هماشي من ال 0 لحد متنزل بل اكونت في السورس بتاعك | Mero | تطوير سيرفرات كونكر | 3 | 2023-08-05 11:39 PM |
مشكلة فى تشغيل السورس | MeGoo | مشكلات السيرفيرات كونكر الشخصيه | 6 | 2019-08-06 07:37 PM |
مساعده في تشغيل السورس | Adel Abd El Hay | مشكلات السيرفيرات كونكر الشخصيه | 5 | 2019-06-02 03:33 PM |
السورس البروتو اضافة اخر تحديث | nova | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-05-22 07:00 PM |