Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 13:13

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# Get Username and password from the Client using sockets ?

Discussion on C# Get Username and password from the Client using sockets ? within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
C# Get Username and password from the Client using sockets ?

Hello , i have a server a client , client have two text box's for Username and password and when i press Login button in the client it shall connect to the server login socket , and the server login socket will check the packet number , if its the specified one for login for example ( 1051) so it will get the username and password value to check if they are same in the database or not , so i can`t do this til now , any help ?

i have an online game code for the server but i don't know the client side how is it ..

here is the code for login at Server

Code:
#region AuthServer_AnnounceReceive
    static void AuthServer_AnnounceReceive(byte[] arg1, Interfaces.ISocketWrapper arg2)
    {

        if (arg1.Length == 240)
        {
            Client.AuthState player = arg2.Connector as Client.AuthState;
            player.Cryptographer.Decrypt(arg1);
            //player.Info = new Authentication();
            //player.Info.Deserialize(arg1);
            byte[] usernamearray = new byte[16];
            Buffer.BlockCopy(arg1, 8, usernamearray, 0, 16);
            var username = Encoding.Default.GetString(usernamearray).Replace("\0", "");

            player.Account = new TQ_Server.Game_Database.cq_account.Table(username);

            byte[] passwordarray = new byte[16];
            Buffer.BlockCopy(arg1, 72, passwordarray, 0, 16);
            var password = (Encoding.Default.GetString(passwordarray).Replace("\0", "")).Split('\0')[0];                

        }
        else
        {

            arg2.Socket.Disconnect(false);
        }
    }
    #endregion:rolleyes:
abdeen is offline  
Old 04/16/2014, 14:46   #2
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
check this better

SuperAids 's chat project

why u use Cryptographer.Decrypt?

u just need to getbytes from the selected offset then get string then search for the string in the database
abdoumatrix is offline  
Thanks
1 User
Old 04/16/2014, 15:02   #3
 
elite*gold: 0
Join Date: Feb 2006
Posts: 726
Received Thanks: 271
What patch?
That is the most important thing.

The amount of crypto changes and password seeds and all that wonderful stuff that has changed over the years.

Is it even Conquer or a different TQ game??

I haven't worked with higher patch servers, but 240 for the length of the authorization packet seems high to me. But in higher patches maybe thats what it is
Aceking is offline  
Old 04/16/2014, 15:31   #4
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
Quote:
Originally Posted by Aceking View Post
What patch?
That is the most important thing.

The amount of crypto changes and password seeds and all that wonderful stuff that has changed over the years.

Is it even Conquer or a different TQ game??

I haven't worked with higher patch servers, but 240 for the length of the authorization packet seems high to me. But in higher patches maybe thats what it is
now 312 Lenght
abdoumatrix is offline  
Thanks
1 User
Old 04/16/2014, 16:29   #5
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Quote:
Originally Posted by abdoumatrix View Post
check this better

SuperAids 's chat project

why u use Cryptographer.Decrypt?

u just need to getbytes from the selected offset then get string then search for the string in the database
i will check this source but i am not using Cryptographer.Decrypt, i just posted a sample from conquer ...
Quote:
Originally Posted by Aceking View Post
What patch?
That is the most important thing.

The amount of crypto changes and password seeds and all that wonderful stuff that has changed over the years.

Is it even Conquer or a different TQ game??

I haven't worked with higher patch servers, but 240 for the length of the authorization packet seems high to me. But in higher patches maybe thats what it is
Quote:
Originally Posted by abdoumatrix View Post
now 312 Lenght
i am talking about sockets not about CONQUER sockets

EDIT :

another question , how i can serialize and send an packet struct , something like this :

PHP Code:
        struct LoginForm
        
{
            public 
string Username;
            public 
string Password;
        } 
abdeen is offline  
Old 04/16/2014, 19:18   #6
 
elite*gold: 0
Join Date: Feb 2006
Posts: 726
Received Thanks: 271
Once you hit enter on the login screen, the client then opens a connection to the authentication server.
Once this connection has been accepted and receive has been called in the socket, then the authentication server receives packet 1051.
Using this packet, you get the username and password depending on the crypto method for that patch.
Aceking is offline  
Thanks
1 User
Old 04/16/2014, 20:35   #7
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
I got Lost

u wanna make a program when u log in using a specific username and pass
and the server search for this username and send the info back.
if so

u need to send for example
username string with max. lenght = 16 at offset 4 for expample.
and pass string with max. lenght = 16 at offset 4+16
from client

and the server get it pack and send the info back into another packet
abdoumatrix is offline  
Thanks
2 Users
Old 04/16/2014, 22:41   #8
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Quote:
Originally Posted by Aceking View Post
Once you hit enter on the login screen, the client then opens a connection to the authentication server.
Once this connection has been accepted and receive has been called in the socket, then the authentication server receives packet 1051.
Using this packet, you get the username and password depending on the crypto method for that patch.
Great , but you are talking about Conquer , its Dot net Chat System ...
abdeen is offline  
Old 04/16/2014, 22:46   #9
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
Quote:
Originally Posted by abdeen View Post
Great , but you are talking about Conquer , its Dot net Chat System ...
all the same , all using socket , all using packets.

PS: i'm talk about a client program request info by username and pass with packets
abdoumatrix is offline  
Thanks
1 User
Old 04/16/2014, 22:57   #10
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Quote:
Originally Posted by abdoumatrix View Post
I got Lost

u wanna make a program when u log in using a specific username and pass
and the server search for this username and send the info back.
if so

u need to send for example
username string with max. lenght = 16 at offset 4 for expample.
and pass string with max. lenght = 16 at offset 4+16
from client

and the server get it pack and send the info back into another packet
could you tell me what about this ?

client Side :

Code:
public class Packet
    {
        [Serializable]
        public class LoginPacket
        {
            private short Packet;
            private int MaxLength;
            private string Username;
            private string Password;
            public LoginPacket(string _Username, string _Password)
            {
                Packet = 1001;
                this.MaxLength = 16;
                this.Username = _Username;
                this.Password = _Password;
            }
        }

        public static byte[] GetPacketBytes(LoginPacket packetHdr)
        {
            MemoryStream ms = new MemoryStream();
            BinaryFormatter formatter = new BinaryFormatter();
            formatter.Serialize(ms, packetHdr);
            return ms.ToArray();
        }
}
Code:
private void LOGIN_BUTTON_Click(object sender, EventArgs e)
        {
        Network.Packets.Packet.LoginPacket LOGIN = new Network.Packets.Packet.LoginPacket(USERNAME_BOX.Text, PASSWORD_BOX.Text);
        byte[] Packet = Network.Packets.PacketS.GetPacketBytes(LOGIN);
        Send(Packet);
        }
Code:
private void LOGIN_BUTTON_Click(object sender, EventArgs e)
        {

        private void Send(Byte[] Buffer)
        {
            if (Buffer != null)
            {
                ChatSocket.Connection.Send(Buffer);
            }
        }
Server Side :

Code:
public void AuthReceive(YukiSocketClient Sender, byte[] packet)
        {
            Network.Packets.Packet.LoginPacket BB = Network.Packets.Packet.GetPacketObject(packet);
        }
Code:
public class Packet
    {
        [Serializable]
        public class LoginPacket
        {
            private short Packet;
            private int MaxLength;
            private string Username;
            private string Password;
        }


        public static LoginPacket GetPacketObject(byte[] packetBytes)
        {
            MemoryStream ms = new MemoryStream();
            ms.Write(packetBytes, 0, packetBytes.Length);
            ms.Position = 0;
            BinaryFormatter formatter = new BinaryFormatter();
            return formatter.Deserialize(ms) as LoginPacket;
        }
}
abdeen is offline  
Old 04/17/2014, 00:10   #11
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
I'm not fimiliar with ur code
but i think 16 packet lenght? for whole packet that is too short
2 + 2 + 16 +16 = 36 is min. lenght that could fit.

i would prefer using this for write
PHP Code:
 public static void WriteString(string argint offsetbyte[] buffer)
        {
            if (
buffer == null)
                return;
            if (
offset buffer.Length 1)
                return;
            
byte[] argEncoded Program.Encoding.GetBytes(arg);
            if (
buffer.Length >= offset arg.Length)
                Array.
Copy(argEncoded0bufferoffsetarg.Length);
        } 
and this for reading

PHP Code:
 public static void ReadString(out string valueint offsetbyte[] buffer)
        {
            
value Program.Encoding.GetString(buffer, (offset 1), buffer[offset]);
        } 
abdoumatrix is offline  
Thanks
1 User
Old 04/17/2014, 03:33   #12
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Quote:
Originally Posted by abdoumatrix View Post
I'm not fimiliar with ur code
but i think 16 packet lenght? for whole packet that is too short
2 + 2 + 16 +16 = 36 is min. lenght that could fit.

i would prefer using this for write
PHP Code:
 public static void WriteString(string argint offsetbyte[] buffer)
        {
            if (
buffer == null)
                return;
            if (
offset buffer.Length 1)
                return;
            
byte[] argEncoded Program.Encoding.GetBytes(arg);
            if (
buffer.Length >= offset arg.Length)
                Array.
Copy(argEncoded0bufferoffsetarg.Length);
        } 
and this for reading

PHP Code:
 public static void ReadString(out string valueint offsetbyte[] buffer)
        {
            
value Program.Encoding.GetString(buffer, (offset 1), buffer[offset]);
        } 

Thanks Button was pressed ... can i get a sample ?
abdeen is offline  
Old 04/17/2014, 12:24   #13
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
first:

Secend:

abdoumatrix is offline  
Thanks
1 User
Old 04/17/2014, 16:38   #14
 
abdeen's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 475
Received Thanks: 15
Quote:
Originally Posted by abdoumatrix View Post
first:

Secend:


thanks brother , its was helpful code , i changed it to be like this :

Server Side :

Client Side


all works fine , but now i want to make or change this socket library to make it for client i mean connect and receive incoming bytes , i tried many times but fails ...

here is Server socket [ its related to Conquer 5517+ Server files ] and i wanna make edits to make it Client socket which connect to server ,receive and send bytes .


Socket Files .

abdeen is offline  
Old 04/17/2014, 17:16   #15
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
check this better

SuperAids 's chat project
abdoumatrix is offline  
Thanks
1 User
Reply

Tags
c#, client, password, server, username


Similar Threads Similar Threads
SBot Password and Username
09/09/2014 - Silkroad Online - 2 Replies
How to find Password for SBot Account after I just purchased it
Invalid Username or Password
10/27/2013 - Minecraft - 2 Replies
Hallo Leute, Unzwar wenn ich mich im Launcher oder in FTB Launcher einloggen will kommt immer Invalid Username or Password. Ich hab mit Email und ohne Email probiert. AUF DER HOMPAGE KANN ICH MICH EINLOGGEN. Nur im Launcher halt nciht und ich benutze die selben Daten hab auch schon deinstalliert und passwort geändert ._. Hilfe!!
Giving away username/password
08/26/2013 - League of Legends Trading - 11 Replies
Yo guys, one question if someone could help me please. I am trying to sell my account - http://www.elitepvpers.com/forum/league-legends-tr ading/2802907-euw-account-all-champions-skins.html Some guy added me and made a proposal to me. First i have to give him my username/password, then he will pay me the money and then i will give him the email. So my question is, can he steal my account if i give him the username/password only? I mean, i know he can, but can i recover it back? Thank you.
CO Opener with my username and password
09/29/2012 - CO2 Programming - 11 Replies
Can Some one told me how to Open Conquer At With my Own Username and password Like >>> enter my username and my password at application {not at conquer} and just click run and its could run sorry for my bad english



All times are GMT +1. The time now is 13:15.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.