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:
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
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
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
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
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;
}
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.
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
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 ...
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();
}
}
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;
}
}
class LoginPacket { public byte[] packets; /// <summary> /// use it like this from client to server /// LoginPacket login = new LoginPacket(true, "new", "new"); /// send(login.ToArray()); /// /// and from server to client /// LoginPacket login = new LoginPacket(false); /// login.GetValues(recivedbytes); // will get the values for u from the recived bytes /// </summary>
public LoginPacket(bool send ,string username="", string pass="") { if (send) { packets = new byte[4 + 16/*username.Length*/ + 16/*pass.Length*/]; Writer.Ushort(1001, 2, packets); Writer.Ushort((ushort)packets.Length, 0, packets); User = username; Pass = pass; } } /// <summary> /// Max Lenght For username and password /// </summary> int Max_Lenght = 16; public string User { get { return Encoding.Default.GetString(packets, 4, Max_Lenght); } set { Writer.String(value, 4, packets); } }
public string Pass { get { return Encoding.Default.GetString(packets, 4+16, Max_Lenght); } set { Writer.String(value, 4, packets); } }
public void GetValues(byte[] packet) { packets = packet; }
class LoginPacket
{
public byte[] packets;
/// <summary>
/// use it like this from client to server
/// LoginPacket login = new LoginPacket(true, "new", "new");
/// send(login.ToArray());
///
/// and from server to client
/// LoginPacket login = new LoginPacket(false);
/// login.GetValues(recivedbytes); // will get the values for u from the recived bytes
/// </summary>
public LoginPacket(bool send ,string username="", string pass="")
{
if (send)
{
packets = new byte[4 + 16/*username.Length*/ + 16/*pass.Length*/];
Writer.Ushort(1001, 0, packets);
Writer.Ushort((ushort)packets.Length, 2, packets);
User = username;
Pass = pass;
}
}
/// <summary>
/// Max Lenght For username and password
/// </summary>
int Max_Lenght = 16;
public string User
{
get
{
return Encoding.Default.GetString(packets, 4, Max_Lenght);
}
set
{
Writer.String(value, 4, packets);
}
}
public string Pass
{
get
{
return Encoding.Default.GetString(packets, 4+16, Max_Lenght);
}
set
{
Writer.String(value, 4, packets);
}
}
public void GetValues(byte[] packet)
{
packets = packet;
}
public byte[] ToArray()
{
return packets;
}
}
thanks brother , its was helpful code , i changed it to be like this :
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 .
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