Proxy Server DHKey Exchance

03/06/2013 15:48 tariqx111#1
Hello, epvp
how are you guys???


i finally finished my proxy(not bot for now)
i maked the client merged (auth and game)
auth encryption is easy cause it doesnt need a dhkey

but my problem is in game encryption
i have lastest encryption and key
this the event or receiving game data
Code:
        public void OnSendToGame(ref byte[] data,bool toserver)
        {
            byte[] xdG = data;
                if (toserver)
                {
                    //client sending to server
                    ServerCrypt.Decrypt(xdG);
                    byte[] exdata = xdG;
                    if (Exchange && exdata.Length != 0)
                    {
                        Exchange = false;
                        File.AppendAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Packets\CS\" + "packet.txt", BitConverter.ToString(data).Replace("-", " ") + Environment.NewLine);
                        ushort position = 7;
                        uint PacketLen = BitConverter.ToUInt32(exdata, position);
                        position = (ushort)(position + 4);
                        int JunkLen = BitConverter.ToInt32(exdata, position);
                        position = (ushort)(position + 4);
                        position = (ushort)(position + ((ushort)JunkLen));
                        int Len = BitConverter.ToInt32(exdata, position);
                        position = (ushort)(position + 4);
                        byte[] pubKey = new byte[Len];
                        for (int x = 0; x < Len; x++)
                        {
                            pubKey[x] = exdata[x + position];
                        }
                        string PubKey = Encoding.UTF7.GetString(pubKey);
                        Program.MainForm.Log("ClientPublicKey:" + PubKey);
                        GameCrypt = DHKeyExchance.HandleClientKeyPacket(PubKey, GameCrypt);
                    }
                    else if(!Exchange && exdata.Length !=0)
                    {
                        ushort ID = BitConverter.ToUInt16(data, 2);
                    }
                    ServerCrypt.Encrypt(xdG);
                }
                else
                {
                    //server sending to client
                    GameCrypt.Decrypt(xdG);
                    byte[] exdata = xdG;
                    if (Exchange)
                    {
                                 File.AppendAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Packets\SC\" + "packet.txt", BitConverter.ToString(data).Replace("-", " ") + Environment.NewLine);
                               //  throw new NotImplementedException();
                    }
                    GameCrypt.Encrypt(xdG);
                }
            data = xdG;
        }
i have the DHKey Exchance for client
but i dont know how it works in server
can some one help me ??

how the server Exchange works ??
this is my problem, i already have the client exchange
03/07/2013 16:43 tariqx111#2
hmmmmm ?
03/07/2013 21:52 donn#3
You don't even know what the code snippet you posted does.

You should look into GameCrypt.Encrypt(byte[]) and GameCrypt.Decrypt(byte[]) methods.
03/08/2013 06:08 go for it#4
after going throw the authentication process

server send p , g and public key to the proxy (as if it was sending it to the client)

proxy use that packet with server to auth with server and being able to encrypt/decrypt what it receive and send to the server

and in the same time proxy generates another private and public keys and send the public key , p and g to the client
once client reply to the proxy it takes the client public key and it figure out the private shared key

so basically you are man in the middle , you reply to the server and make common private shared key , and create a fake dh public key and use it with client to make another common private shared key
so now you will have 2 private shared keys , one with client and one with server
use one when receive from client to decrypt packets with the private shared key between proxy/client and edit them
then encrypt that packets by the private shared key of server/proxy and send to the server
on receiving from the server you decrypt it with the private shared key of proxy/server and so on


that's way far from the normal server-client , so leaching isn't really easy to be done unless you really know what you are doing
if you can't do it on your own then forget it cuz no proxy farmwork are up to date and it's not easy to copy from the source
but still everything is public tho
03/08/2013 08:40 tariqx111#5
Quote:
Originally Posted by go for it View Post
after going throw the authentication process

server send p , g and public key to the proxy (as if it was sending it to the client)

proxy use that packet with server to auth with server and being able to encrypt/decrypt what it receive and send to the server

and in the same time proxy generates another private and public keys and send the public key , p and g to the client
once client reply to the proxy it takes the client public key and it figure out the private shared key

so basically you are man in the middle , you reply to the server and make common private shared key , and create a fake dh public key and use it with client to make another common private shared key
so now you will have 2 private shared keys , one with client and one with server
use one when receive from client to decrypt packets with the private shared key between proxy/client and edit them
then encrypt that packets by the private shared key of server/proxy and send to the server
on receiving from the server you decrypt it with the private shared key of proxy/server and so on


that's way far from the normal server-client , so leaching isn't really easy to be done unless you really know what you are doing
if you can't do it on your own then forget it cuz no proxy farmwork are up to date and it's not easy to copy from the source
but still everything is public tho
understand thank you.

Quote:
Originally Posted by go for it View Post
after going throw the authentication process

server send p , g and public key to the proxy (as if it was sending it to the client)

proxy use that packet with server to auth with server and being able to encrypt/decrypt what it receive and send to the server

and in the same time proxy generates another private and public keys and send the public key , p and g to the client
once client reply to the proxy it takes the client public key and it figure out the private shared key

so basically you are man in the middle , you reply to the server and make common private shared key , and create a fake dh public key and use it with client to make another common private shared key
so now you will have 2 private shared keys , one with client and one with server
use one when receive from client to decrypt packets with the private shared key between proxy/client and edit them
then encrypt that packets by the private shared key of server/proxy and send to the server
on receiving from the server you decrypt it with the private shared key of proxy/server and so on


that's way far from the normal server-client , so leaching isn't really easy to be done unless you really know what you are doing
if you can't do it on your own then forget it cuz no proxy farmwork are up to date and it's not easy to copy from the source
but still everything is public tho
i do as you say
this is the results:

LOG:
Code:
[AuthClient]Connected
[AuthServer]Connected
[AuthClient]Disconnected
[AuthServer]Disconnected
[GameClient]Connected
[GameServer]Connected
G: 05
P: A320A85EDD79171C341459E94807D71D39BB3B3F3B5161CA84894F3AC3FC7FEC317A2DDEC83B66D30C29261C6492643061AECFCF4A051816D7C359A6A7B7D8FB
ServerPublicKey:58F8D50519FCFA1B80C9DA608CBD776FCA2DB5A76437EF705EA8819DEC27B86CFA242A93887EEA8C3CCA997CA3510309535F2A492816ED6EF6E35840F5C4B53F
FAServerPublicKey:6113F5B0273489BFF430DFA7CA968EBCB03742084B5E14820BD6B647E4189DFBA6B49D176C056015BC49C4CA2EEF545CB4B360532A11D2FF10223E2732329E59
ClientPublicKey:4BD6FE4261E9A7E89BDCB909773000C69FC42A0F63AD684E7F0596C0E98AD2CBA3F6B272E4DB5BBCF9CE80246D4FD059362272EF35A84AC840ECBCFD0AC38B52
FAClientPublicKey:01DBADC8C1E41812240B42A18EBCBB3E80E9C775F872B58A02042B2A45472A58BFB88D7CB83F13A0F4FA08992B38FAC7924CDD36F2FB2BDAECDA02A766A54C98
[GameServer]Disconnected
Final Code :
Code:
        public void SetupCrypto()
        {
            try
            {
                BigNumber realClientPublicKey = BigNumber.FromHexString(ClientExchange.PublicKey);
                BigNumber realServerPublicKey = BigNumber.FromHexString(ServerExchange.PublicKey);
                GameCrypt.SetKey(GameCrypt.DH.ComputeKey(realClientPublicKey));
                ServerCrypt.SetKey(ServerCrypt.DH.ComputeKey(realServerPublicKey));
                GameCrypt.Blowfish.EncryptIV = this.ServerExchange.ClientIV;
                GameCrypt.Blowfish.DecryptIV = this.ServerExchange.ServerIV;
                ServerCrypt.Blowfish.EncryptIV = this.ServerExchange.ServerIV;
                ServerCrypt.Blowfish.DecryptIV = this.ServerExchange.ClientIV;
            }
            catch { }
        }
        public bool Exchange = true;
        public void OnSendToGame(ref byte[] data,bool toserver)
        {
            try
            {
                if (data.Length == 0)
                {
                    return;
                }
                byte[] Buffer = data;
                if (toserver)
                {
                    //client sending to server
                    byte[] exdata = Buffer;
                    if (Exchange && exdata.Length > 35)
                    {
                        Exchange = false;
                        ServerCrypt.Decrypt(exdata);
                        ClientExchange = new ClientExchange(exdata);
                        Program.MainForm.Log("ClientPublicKey:" + ClientExchange.PublicKey);
                        Log("FAClientPublicKey:" + GameCrypt.DH.PublicKey.ToHexString());
                        ClientExchange.Edit(exdata, GameCrypt.DH.PublicKey.ToHexString());
                        //ServerCrypt.Encrypt(exdata);
                        GameServer.Send(exdata);
                        skipPacket = true;
                        SetupCrypto();
                        return;

                    }
                    if (!Exchange && exdata.Length > 1)
                    {
                        ServerCrypt.Decrypt(Buffer);
                        ushort ID = BitConverter.ToUInt16(Buffer, 2);
                    }
                    ServerCrypt.Encrypt(Buffer);
                }
                else
                {
                    //server sending to client

                    byte[] exdata = Buffer;
                    if (Exchange)
                    {
                        GameCrypt.Decrypt(exdata);
                        ServerExchange = new ServerExchange(exdata);
                        Log("G: " + ServerExchange.G);
                        Log("P: " + ServerExchange.P);
                        this.GameCrypt.DH = new DH(BigNumber.FromHexString(this.ServerExchange.P), BigNumber.FromHexString(this.ServerExchange.G));
                        this.ServerCrypt.DH = new DH(BigNumber.FromHexString(this.ServerExchange.P), BigNumber.FromHexString(this.ServerExchange.G));
                        this.GameCrypt.DH.GenerateKeys();
                        this.ServerCrypt.DH.GenerateKeys();
                        this.ServerExchange.Edit(exdata, this.ServerCrypt.DH.PublicKey.ToHexString());
                        Program.MainForm.Log("ServerPublicKey:" + ServerExchange.PublicKey);
                        Log("FAServerPublicKey:" + ServerCrypt.DH.PublicKey.ToHexString());
                        skipPacket = true;
                        //GameCrypt.Encrypt(exdata);
                        GameClient.Send(exdata);
                        return;
                    }
                    if (!Exchange && exdata.Length > 1)
                    {
                        GameCrypt.Decrypt(Buffer);
                        ushort ID = BitConverter.ToUInt16(Buffer, 2);
                    }
                    GameCrypt.Encrypt(Buffer);
                }
                data = Buffer;
            }
            catch (Exception e)
            {
                Log("OnSendToGame:" + e + "");
                GameServer.Disconnect(false);
                GameClient.Disconnect(false);
                GameServer = null;
                GameClient = null;
                Program.MainForm.server.DoOnDisconnected(this,"[GameServer + GameClient]");
            }
        }
        ServerExchange ServerExchange;
        ClientExchange ClientExchange;
Conquer freeze in logging in game server

What is the problem ?
what i need to update ?
03/08/2013 13:35 donn#6
Stop leeching ProxyParadise source code. You will never be able to update it without basic knowledges in programming, packets and encryption.

Client is freezing on login because encryption is not updated in ProxyParadise. You should do it, all the required info is released.
03/08/2013 14:30 tariqx111#7
Quote:
Originally Posted by donn View Post
Stop leeching ProxyParadise source code. You will never be able to update it without basic knowledges in programming, packets and encryption.

Client is freezing on login because encryption is not updated in ProxyParadise. You should do it, all the required info is released.
stop replying if you dont want to help this encryption is not from proxyparadise and pro4never is sharing the code
i just use proxy phoneix dh key exchange
and the encryption is from arabic conquer server source(the proxy is for arabic co)
most code is by me
socket,merged client,server,packet handler........
and other things is public and if pro4never or any one other dont want i use him code
just say to me and i wont....sorry
i also tried to use this :[Only registered and activated users can see links. Click Here To Register...]
on english co(to know if the problem is from arabic cryptography) and i got Unable to read beyond the end of the stream.....sorry again donn

edit : some time he dont give Unable to read beyond the end of the stream. give me the information then disconnect
03/19/2013 12:52 xmen01235#8
All of the information were given already on this forum and if you don't know how to use or find it then you don't deserve to have your own proxy.