[Feature Analysis] Rejection Messages

08/30/2013 23:02 Spirited#1
Hey everyone, I know how hard it is to code features when you don't have a packet sniffer and such. Not just that, it's very difficult when you're programming with a patch that's no longer current. This feature is even more so difficult because the feature is not in English, it's in Chinese. Here's some more information about it.

Packet Example:
You've probably seen something like what's below as a way to reject clients in the lower patches (below 5032ish). Take a look at offsets 8 and 12.

Code:
    public static byte[] WrongPassword()
            {
                byte[] PacketData = new byte[0x20];
                PacketData[0] = 0x20;
                PacketData[1] = 0x00;
                PacketData[2] = 0x1f;
                PacketData[3] = 0x04;
                PacketData[4] = 0x00;
                PacketData[5] = 0x00;
                PacketData[6] = 0x00;
                PacketData[7] = 0x00;
                PacketData[8] = 0x01;
                PacketData[9] = 0x00;
                PacketData[10] = 0x00;
                PacketData[11] = 0x00;
                PacketData[12] = 0xd5;
                PacketData[13] = 0xca;
                PacketData[14] = 0xba;
                PacketData[15] = 0xc5;
                PacketData[16] = 0xc3;
                PacketData[17] = 0xfb;
                PacketData[18] = 0xbb;
                PacketData[19] = 0xf2;
                PacketData[20] = 0xbf;
                PacketData[21] = 0xda;
                PacketData[22] = 0xc1;
                PacketData[23] = 0xee;
                PacketData[24] = 0xb4;
                PacketData[25] = 0xed;
                PacketData[26] = 0x00;
                PacketData[27] = 0x00;
                PacketData[28] = 0x00;
                PacketData[29] = 0x00;
                PacketData[30] = 0x00;
                PacketData[31] = 0x00;
                return PacketData;
            }
My Analysis:
So, to send a message, you first have to send the token for the rejection. The token you might see is "1" in offset 8. First, you should know that there are many tokens supported by the lower patches (more than you might think). Below is a list of tokens supported by the English client on the older patches (I'm using Conquer 1.0 in these tests).
  • Invalid Password = 1
  • Server Offline = 11
  • Banned = 12

I did find more (quite a lot more), but I couldn't get them to work with the English client on the patch I'm working on (4274). Using these tokens isn't too easy. For each token, you also need to send a message that the client recognizes. Unfortunately, these messages are in Chinese. I've been using ollydbg to get these messages, but I can't read assembly well enough to get them all yet (I'm an amateur at reverse engineering). Here are the messages I've found (using encoding GB2312):

帐号名或口令错 (Invalid account name or password):
0xd5, 0xca, 0xba, 0xc5, 0xc3, 0xfb, 0xbb, 0xf2, 0xbf, 0xda, 0xc1, 0xee, 0xb4, 0xed

该帐号被封号 (This account is banned)
0xb8, 0xc3, 0xd5, 0xca, 0xba, 0xc5, 0xb1, 0xbb, 0xb7, 0xe2, 0xba, 0xc5

请稍后重新登录 (Server Offline / Sign in later)
0xc7, 0xeb, 0xc9, 0xd4, 0xba, 0xf3, 0xd6, 0xd8, 0xd0, 0xc2, 0xb5, 0xc7, 0xc2, 0xbc

Hopefully this was informative enough for others more experienced than I am to reverse the client and understand what to look for (and what they're looking at). Here are more strings I found that didn't quite work with my patch:

6: 小时数已用尽 (Not Enough Credits)
7: 帐号已过期 (Not Enough Game Time) - Didn't bother testing actually.
10: 服务器未启动 (Unknown Server) - Didn't bother testing as well.
13: 该帐号不能登录 (Bar Password)
20: 服务器忙请稍候 (Server Busy)
21: 服务器人数已满 (Server Full)
999: 数据库错误 (Default Message) - Didn't bother testing.

Here's a small thing I programmed for making the hex arrays (I'm too lazy to type these out):
Code:
byte[] test5 = Encoding.GetEncoding(936).GetBytes("服务器未启动");

            string testString = "";
            for (int index = 0; index < test5.Length; index++)
            {
                testString += "0x" + test5[index].ToString("X0") + ", ";
            }
That's it. Cheers.
08/31/2013 00:48 nTL3fTy#2
I believe this method of displaying errors has been removed from the more recent patches and replaced with a simple enum:
Code:
STR_CONNECT_ERROR_MSG_TYPE_UNKNOWN=Unknown Error
STR_CONNECT_ERROR_MSG_TYPE_000=Changing Map
STR_CONNECT_ERROR_MSG_TYPE_001=Invalid Account ID or Password
STR_CONNECT_ERROR_MSG_TYPE_006=Point Card Expired
STR_CONNECT_ERROR_MSG_TYPE_007=Monthly Card Expired
STR_CONNECT_ERROR_MSG_TYPE_010=Server maintenance for 30 minutes. Please try again later!
STR_CONNECT_ERROR_MSG_TYPE_011=Please try again later.
STR_CONNECT_ERROR_MSG_TYPE_012=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_013=Net cafe mode. Invalid Account ID or Password.
STR_CONNECT_ERROR_MSG_TYPE_014=Net cafe mode. No more accounts can be logged, at this time.
STR_CONNECT_ERROR_MSG_TYPE_020=Server is busy.
STR_CONNECT_ERROR_MSG_TYPE_021=Server is busy. Please try again, later.
STR_CONNECT_ERROR_MSG_TYPE_022=Your account has been locked. Please contact GM for more help.
STR_CONNECT_ERROR_MSG_TYPE_024=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_025=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_026=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_027=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_028=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_030=This account has not been activated.
STR_CONNECT_ERROR_MSG_TYPE_031=Failed to activate the account.
STR_CONNECT_ERROR_MSG_TYPE_040=Invalid Input
STR_CONNECT_ERROR_MSG_TYPE_041=Invalid Info
STR_CONNECT_ERROR_MSG_TYPE_042=Timed Out
STR_CONNECT_ERROR_MSG_TYPE_043=Please recheck the serial number or retrieve a new one.
STR_CONNECT_ERROR_MSG_TYPE_044=Invalid Sub-password
STR_CONNECT_ERROR_MSG_TYPE_045=Please input Sub-password.
STR_CONNECT_ERROR_MSG_TYPE_046=Unbound
STR_CONNECT_ERROR_MSG_TYPE_050=Non-cooperator Account
STR_CONNECT_ERROR_MSG_TYPE_051=Sorry, but you have used up your login attempts. Please wait 30 minutes and try again.
STR_CONNECT_ERROR_MSG_TYPE_052=Failed to login
STR_CONNECT_ERROR_MSG_TYPE_053=The same server
STR_CONNECT_ERROR_MSG_TYPE_054=Database Error
STR_CONNECT_ERROR_MSG_TYPE_055=Failed to connect to the database.
STR_CONNECT_ERROR_MSG_TYPE_056=Failed to connect
STR_CONNECT_ERROR_MSG_TYPE_057=Invalid Account ID
STR_CONNECT_ERROR_MSG_TYPE_058=Validation timed out.
STR_CONNECT_ERROR_MSG_TYPE_059=Servers are not configured correctly.
STR_CONNECT_ERROR_MSG_TYPE_060=Passpod Server Disconnected
STR_CONNECT_ERROR_MSG_TYPE_061=Failed to process Passpod return
STR_CONNECT_ERROR_MSG_TYPE_062=Passpod Password Expired
STR_CONNECT_ERROR_MSG_TYPE_063=Passpod Verification Failed
STR_CONNECT_ERROR_MSG_TYPE_064=Passpod Certification Expired
STR_CONNECT_ERROR_MSG_TYPE_065=Passpod Certification Disabled
STR_CONNECT_ERROR_MSG_TYPE_066=Failed to find the user.
STR_CONNECT_ERROR_MSG_TYPE_067=Passpod Server Error
STR_CONNECT_ERROR_MSG_TYPE_068=Passpod has not been input.
STR_CONNECT_ERROR_MSG_TYPE_070=Server Locked
STR_CONNECT_ERROR_MSG_TYPE_071=Login has been restricted. Please check the login limit, and try again.
STR_CONNECT_ERROR_MSG_TYPE_072=Account Locked by Phone
STR_CONNECT_ERROR_MSG_TYPE_073=Authentication Protocol is invalid or expired.
STR_CONNECT_ERROR_MSG_TYPE_501=The account has not been bound to any phone
STR_CONNECT_ERROR_MSG_TYPE_502=The key is wrong. Please rebind it.
STR_CONNECT_ERROR_MSG_TYPE_504=The sub-key is wrong.
STR_CONNECT_ERROR_MSG_TYPE_506=Please input the sub-key.
STR_CONNECT_ERROR_MSG_TYPE_507=Failed to call.
STR_CONNECT_ERROR_MSG_TYPE_508=Failed to login QQ account
STR_CONNECT_ERROR_MSG_TYPE_999=Database Error
08/31/2013 01:06 Spirited#3
Quote:
Originally Posted by nTL3fTy View Post
I believe this method of displaying errors has been removed from the more recent patches and replaced with a simple enum:
Code:
STR_CONNECT_ERROR_MSG_TYPE_UNKNOWN=Unknown Error
STR_CONNECT_ERROR_MSG_TYPE_000=Changing Map
STR_CONNECT_ERROR_MSG_TYPE_001=Invalid Account ID or Password
STR_CONNECT_ERROR_MSG_TYPE_006=Point Card Expired
STR_CONNECT_ERROR_MSG_TYPE_007=Monthly Card Expired
STR_CONNECT_ERROR_MSG_TYPE_010=Server maintenance for 30 minutes. Please try again later!
STR_CONNECT_ERROR_MSG_TYPE_011=Please try again later.
STR_CONNECT_ERROR_MSG_TYPE_012=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_013=Net cafe mode. Invalid Account ID or Password.
STR_CONNECT_ERROR_MSG_TYPE_014=Net cafe mode. No more accounts can be logged, at this time.
STR_CONNECT_ERROR_MSG_TYPE_020=Server is busy.
STR_CONNECT_ERROR_MSG_TYPE_021=Server is busy. Please try again, later.
STR_CONNECT_ERROR_MSG_TYPE_022=Your account has been locked. Please contact GM for more help.
STR_CONNECT_ERROR_MSG_TYPE_024=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_025=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_026=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_027=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_028=This account has been banned.
STR_CONNECT_ERROR_MSG_TYPE_030=This account has not been activated.
STR_CONNECT_ERROR_MSG_TYPE_031=Failed to activate the account.
STR_CONNECT_ERROR_MSG_TYPE_040=Invalid Input
STR_CONNECT_ERROR_MSG_TYPE_041=Invalid Info
STR_CONNECT_ERROR_MSG_TYPE_042=Timed Out
STR_CONNECT_ERROR_MSG_TYPE_043=Please recheck the serial number or retrieve a new one.
STR_CONNECT_ERROR_MSG_TYPE_044=Invalid Sub-password
STR_CONNECT_ERROR_MSG_TYPE_045=Please input Sub-password.
STR_CONNECT_ERROR_MSG_TYPE_046=Unbound
STR_CONNECT_ERROR_MSG_TYPE_050=Non-cooperator Account
STR_CONNECT_ERROR_MSG_TYPE_051=Sorry, but you have used up your login attempts. Please wait 30 minutes and try again.
STR_CONNECT_ERROR_MSG_TYPE_052=Failed to login
STR_CONNECT_ERROR_MSG_TYPE_053=The same server
STR_CONNECT_ERROR_MSG_TYPE_054=Database Error
STR_CONNECT_ERROR_MSG_TYPE_055=Failed to connect to the database.
STR_CONNECT_ERROR_MSG_TYPE_056=Failed to connect
STR_CONNECT_ERROR_MSG_TYPE_057=Invalid Account ID
STR_CONNECT_ERROR_MSG_TYPE_058=Validation timed out.
STR_CONNECT_ERROR_MSG_TYPE_059=Servers are not configured correctly.
STR_CONNECT_ERROR_MSG_TYPE_060=Passpod Server Disconnected
STR_CONNECT_ERROR_MSG_TYPE_061=Failed to process Passpod return
STR_CONNECT_ERROR_MSG_TYPE_062=Passpod Password Expired
STR_CONNECT_ERROR_MSG_TYPE_063=Passpod Verification Failed
STR_CONNECT_ERROR_MSG_TYPE_064=Passpod Certification Expired
STR_CONNECT_ERROR_MSG_TYPE_065=Passpod Certification Disabled
STR_CONNECT_ERROR_MSG_TYPE_066=Failed to find the user.
STR_CONNECT_ERROR_MSG_TYPE_067=Passpod Server Error
STR_CONNECT_ERROR_MSG_TYPE_068=Passpod has not been input.
STR_CONNECT_ERROR_MSG_TYPE_070=Server Locked
STR_CONNECT_ERROR_MSG_TYPE_071=Login has been restricted. Please check the login limit, and try again.
STR_CONNECT_ERROR_MSG_TYPE_072=Account Locked by Phone
STR_CONNECT_ERROR_MSG_TYPE_073=Authentication Protocol is invalid or expired.
STR_CONNECT_ERROR_MSG_TYPE_501=The account has not been bound to any phone
STR_CONNECT_ERROR_MSG_TYPE_502=The key is wrong. Please rebind it.
STR_CONNECT_ERROR_MSG_TYPE_504=The sub-key is wrong.
STR_CONNECT_ERROR_MSG_TYPE_506=Please input the sub-key.
STR_CONNECT_ERROR_MSG_TYPE_507=Failed to call.
STR_CONNECT_ERROR_MSG_TYPE_508=Failed to login QQ account
STR_CONNECT_ERROR_MSG_TYPE_999=Database Error
You're correct. They replaced this system so you only send the id. All of the above are available after a certain patch. They slowly added more and more.
08/31/2013 08:11 Spirited#4
Cleaned. I'm done with the spam. The childish sarcasm driving members away has got to stop.
08/31/2013 08:41 LordGragen.#5
Wonderful release thank you.