TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
andrei hooba
NA
63
24.1k
NetworkStream / stream.write , hexa values.
Feb 21 2012 2:30 PM
Hello,
After tcpclient is connected i must send this packet for login.:
HEXA ASCII
00 33 00 07 00 00 0
3 B7-24 15
00 00 00 20
66 63
.3.....·$.... fc
66 38 36 34 63 39 61 37-34 39 33 38 39 65 30 39
f864c9a749389e09
63 65 37 39 34 63 62 65-66 39 61 66 30 61
00 05 ce794cbef9af0a..
35 2E 34 2E 34 00 09 00-01 00 00 00 03 50 4E 47 5.4.4........PNG
i sniffed this packet, after i logged manually.
OK. here is my code
int userid = 62333973;
string userid_hex_form = Convert.ToString(userid, 16); \\<---- this will be: 3B72415
string a = "0033000700000";
string b = "00000020";
string c = a + userid_hex_form + b; \\ <---- all this should be: 00 33 00 07 00 00 0
3 B7-24 15
00 00 00 20
string d = "0005352E342E340009000100000003504E47";
string f = HexAsciiConvert(c);
string g = HexAsciiConvert(d);
try
{
string szData = (f + sSID + g); \\ sSID (sessionid) is the green code, this code changes on every login
byte[] byData = System.Text.Encoding.ASCII.GetBytes(szData);
Int32 port = 8080;
TcpClient client = new TcpClient(sGameServerIp, port);
NetworkStream stream = client.GetStream();
stream.Write(byData, 0, byData.Length);
byData = new Byte[1024];
String responseData = String.Empty;
Int32 bytes = stream.Read(byData, 0, byData.Length);
responseData = System.Text.Encoding.ASCII.GetString(byData, 0, bytes);
}
catch (SocketException e)
{
}
static string HexAsciiConvert(string hex)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i <= hex.Length - 2; i += 2)
{
sb.Append(Convert.ToString(Convert.ToChar(Int32.Parse(hex.Substring(i, 2),
System.Globalization.NumberStyles.HexNumber))));
}
return sb.ToString();
}
but my packet looks like:
00 33 00 07 00 00 03 3F-24 15 00 00 00 20 37 64 .3.....?$.... 7d
65 39 63 37 32 36 62 30-36 34 39 61 63 34 65 37 e9c726b0649ac4e7
65 30 38 32 64 32 37 35-33 62 63 63 33 64 00 05 e082d2753bcc3d..
35 2E 34 2E 34 00 09 00-01 00 00 00 03 50 4E 47 5.4.4........PNG
any ideas?
thx
Reply
Answers (
15
)
Encoding and Serialization
Automatic display of a character