hey. whats up.
yeah the AA3 guys deleted all my posts. :(
sry :(
but i'll repost everything here.
the server ip:port:queryport i was using is 66.209:32:242:8777:39300
Softman if you were the one that contacted me through email thxs ^_^. if not then sry to who ever i am misquoting here...
softman stated he believe the protocol to be zlib encrypted. now i tried zlib decrypting it from the data start (after the AA3SplitPacket end) but it did not produce plain text. which to me indicates i have the wrong start position, it has additional encyption before, additional encyption after, or i had an arguement wrong to zlib.
i've never used zlib before but this is what i pulled together from examples
Code:
Byte *ZLibDecompress(Byte *data, UInt32 dataLen)
{
Byte *retVal = new Byte[dataLen * 10];
z_stream c_stream;
c_stream.zalloc = (alloc_func)0;
c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
GSInt32 err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
c_stream.next_in = (Bytef*)data;
c_stream.next_out = retVal;
while (c_stream.total_in != 50000 && c_stream.total_out < dataLen) {
c_stream.avail_in = c_stream.avail_out = dataLen;
err = deflate(&c_stream, Z_NO_FLUSH);
}
for (;;) {
c_stream.avail_out = 1;
err = deflate(&c_stream, Z_FINISH);
if (err == Z_STREAM_END) break;
}
err = deflateEnd(&c_stream);
return retVal;
}
the general request/response goes like this
client --> query request --> server
server --> 1 or more possible encrypted packets containing query response--> client
client --> logout --> server
server --> resultCode --> client
The AA3 Packet Header:
Code:
struct AA3PacketHeader
{
Byte byte0XE1; //1
Byte byte0X6F; //2
Int16 encyptionVector; //3, 4
UInt32 commandId; //5, 6, 7, 8 // AA3Commands
Int16 keyValueEntries; //9, 10
};
the AA3 Packet command Ids
Code:
enum AA3Commands
{
AA3_LOGOUT = 0x01000100,
AA3_QUERY_SERVER = 0x01000200,
AA3_UNENCRYPTED_QUERY_RESP = 0x01000200,
AA3_SINGLE_PACKET_QUERY_RESP = 0x01020200, //encrypted
AA3_MULTI_PACKET_QUERY_RESP = 0x01030200, //encrypted
};
the response packets come in three types.
1. just header. seems to be used if the query response is unsplit
2. a command packet
3. a multiple packet response
Code:
struct AA3CommandPacket
{
AA3PacketHeader hdr;
Int16 commandLength; //11, 12
};
struct AA3SplitPacket
{
AA3PacketHeader hdr;
Int16 packetNum; //11, 12
Int16 numPackets; //13, 14
};
a command seems to look like the following
Code:
struct AA3Command
{
Char command[commandLength];
Int8 minStringLen;
Int8 maxStringLen;
Int8 unknown; //seems to be a null term
AA3String commandParam;
};
struct AA3String
{
char str[];
char nullterm;
};
an example query request
Code:
e1 6f 00 00 01 00 02 00 01 00 0a 00 70 6c 61 79 65 72 4e 61 6d 65 06 08 00 71 75 65 72 79 69 74 00 ??o..........playerName...queryit.
an example encrypted packet
Code:
e1 6f 6c ff 01 03 02 00 03 00 00 00 02 00 78 da 95 57 5b 4f dc 46 14 3e 40 48 9a 34 40 08 b9 56 aa ba 7d ae 70 67 f6 be 0f ??ol??..........x??.W[O??F.>@H??4@..V????}??pg??..
48 dd 90 05 b6 0a 2c c5 2b 90 1a 45 68 b0 87 65 82 ed d9 8c 6d 60 53 f5 b5 bf bb c7 5e df b1 a3 0d 5a 90 cf 77 ce 7c e7 32 H??..??.,??+..Eh??.e.??????m`S??????????^??????.Z.??w??|??2
9f 87 d9 75 60 9e a7 c4 85 ef f1 23 66 73 f7 d1 7f b0 0e 2e 57 37 5c 9d 72 e5 0a e9 c0 b3 c8 1e 4e fb a6 a9 b8 eb c2 46 84 ??.??u`??????.????#fs????.??..W7\.r??.????.??.N????????????F.
1c 48 d7 3b 96 ca 4b 42 fe f2 b9 9a 85 c8 f3 08 39 b6 d8 8c ab 5d e9 3b 69 d4 07 39 11 4e 90 2d 41 fa a6 2d 9c 81 cd 84 b5 .H??;?????KB????.??.????.9????????]??;i??.9.N.-A????-??.??.??
91 45 82 98 cd 08 78 e7 0b cb 3c f2 ed 0b ae e2 55 7b 16 9b ec 5e 71 e6 b9 eb 59 44 ca e9 ab 8c fd 81 33 97 9b 7a 68 bf c9 ???E.????.x??.??<????.????U{..??^q??.??YD??????????.3???.zh????
e0 a3 cb 4b 61 08 66 cd 3d cf 33 9e 63 e6 ba b7 52 99 2f b2 98 ef 5c 5f f8 ae c7 d5 cb 0c aa 0b db 77 84 87 53 ca 95 70 3a ??????Ka.f??=??3??c??????R???/.????\_??????????.??.??w..S??.p:
1a 1e c7 f6 3e f6 10 f4 b1 9e 99 59 60 bf 2c d8 03 c7 90 26 37 d7 22 f8 90 4d 03 f4 6d 62 de cd 27 39 b8 9b 72 25 b8 63 f0 ..????>??.?????????Y`??,??.??.&7??"??.M.??mb????'9??.r%??c??
67 45 97 bb 95 22 fa 94 1b 1e f3 a4 72 13 06 e1 14 19 36 13 97 1b 6c b4 2e be f2 ad 3c 34 96 be 1a be 2f c4 8d 67 53 fe 22 gE?????."?????..????r..??..6.???.l??..????<4???.../??.gS??"
0f 9d 32 25 98 e3 c5 3d 8d 30 03 f3 84 33 d1 67 38 31 fb 97 44 1d cc 12 38 74 16 0c ec 84 7f f1 85 e2 36 77 3c 37 6e e5 84 ..2%??????=.0.??.3??g81?????D.??.8t..??..??.??6w<7n??.
4f 7d 2f f4 c6 29 f5 6b 61 59 27 21 57 1c 94 b6 f6 14 a6 61 47 c1 a0 08 6c 45 96 2e 2d 53 c4 e0 46 04 46 5a 26 f0 3a 8e ca O}/????)??kaY'!W.???????.??aG?? .lE???.-S????F.FZ&??:????
4b 3a 8d 8c 06 4f 60 33 02 76 2d 94 c3 89 b4 10 fa 39 82 06 0e b7 67 47 dc f7 14 36 f4 15 c5 65 48 85 ee b7 59 b7 ce 0d 5f K:.??.O`3.v-?????.??.??9...??gG????.6??.??eH.????Y????._
25 ae e7 b1 2b 19 3e 81 97 11 b6 87 63 18 73 66 0f 1d 93 df 11 f8 29 86 51 48 81 cb 43 17 6a d8 e4 2a b3 24 d0 5e 3c 87 b4 %??????+.>.???.??.c.sf..?????.??).QH.??C.j????*.$??^<.??
a9 10 fe e2 33 33 8e 8f 7b c8 f4 19 8f 69 1e 52 28 ef 90 9b c2 88 b0 57 11 36 ba f8 8c 89 c4 0d 8f f0 78 ea c7 b8 27 04 d6 ??.????33??.{????..i.R(??..??????W.6??????.??..??x??????'.??
e2 79 ce 9d af b3 a6 7e 25 3d 37 68 c1 4c 2b 4f 1d 07 c2 cb c0 59 d1 a7 39 82 b1 a4 5d 64 86 14 17 3c 16 36 0f 65 6d a6 8b ??y??.??.??~%=7h??L+O..??????Y????9.????]d...<.6.em??.
02 0a 5a 26 07 5a 94 03 ad 92 03 2d ca 81 de 97 03 fd b6 1c 68 b5 1c 68 89 1c 68 b9 1c e8 37 e4 40 cb e5 40 ab e4 40 ef cb ..Z&.Z???.?????.-??.?????.????.h??.h..h..??7??@????@????@????
81 96 c9 81 96 c8 81 56 c8 81 e6 e4 40 f3 72 a0 55 72 a0 e5 72 a0 e5 72 a0 39 39 d0 fb 72 a0 25 72 a0 39 39 d4 cb e4 50 2f .?????.?????.V??.????@??r Ur ??r ??r 99????r %r 99??????P/
ca a1 5e 25 87 7a 51 0e f5 1c 7b a3 8c bd 51 64 6f 54 b1 37 8a ec 8d 1c 7b b3 8c bd 59 64 6f 56 b1 37 8b ec cd 1c 7b ab 8c ????^%.zQ.??.{????.QdoT??7????..{.??.YdoV??7.????.{????
bd 55 64 6f 55 b1 b7 8a ec ad 1c 7b bb 8c bd 5d 64 6f 57 b1 b7 8b ec ed 1c 7b a7 8c bd 53 64 ef 54 b1 77 8a ec 9d 1c 7b b7 .UdoU??????????.{????.]doW????.????.{????.Sd??T??w????..{??
8c bd 5b 64 ef 56 b1 77 8b ec dd 1c 7b af 8c bd 57 64 ef 55 b1 f7 8a ec bd e4 d5 0b 5f 19 02 2f 4a ce 3f 82 17 ae fc 01 48 ??.[d??V??w.????.{????.Wd??U????????.????._../J???..????.H
e0 4d c5 09 98 c6 c6 af 21 c9 a7 a0 a5 29 e8 bd 14 b4 32 05 bd 97 22 38 77 93 fb e8 29 b3 fc f0 42 fa 10 1a 1a d1 08 5e 4c ??M??.????????!???? ??)??..??2..???"8w???????).????B??...??.^L
db 5d ad de a8 6b b4 4d b5 6e 1b 56 a1 db e9 74 02 77 af 41 08 ac 00 0d de cb 49 70 8d 0d 33 b9 08 1d fd de 0f ff 3c 06 d2 ??]??????k??M??n.V??????t.w??A.??..????Ip..3...????.??<.??
3c 27 6d da 25 bd 25 20 e1 87 86 1f 92 fc 7d 04 1f 07 b5 51 ed fd a7 df a0 ef 48 ef 8a ab 5a 70 79 9b 57 ed 6a 86 b4 6b fd <'m??%.% ??...?????}...??Q???????? ??H??????Zpy.W??j.??k??
7e a3 36 b7 6b c2 ad bd 93 ca f9 35 59 b5 09 43 7b ca 0c ef dc 64 b3 73 c3 92 be 39 7b 0c bd f8 67 19 8b 5b 02 fc 90 55 b0 ~??6??k????.???????5Y??.C{??.????d.s?????.9{..??g..[.??.U??
98 9a f0 15 10 ce e5 32 30 f9 00 4c 7e 83 c9 cf 84 63 ca 5b 77 05 93 cf 96 a0 31 2f 6b 03 b6 77 06 67 3b db 9f f1 9a 29 d5 ??????..????20??.L~??????.c??[w.???????? 1/k.??w.g;????????)??
f9 04 9e c0 be 62 9f f9 ad 7b 2d 2a e7 52 b4 1f c2 98 ec 91 13 ba 0c 2d 12 37 9f b4 4d d6 a0 de d4 68 af 83 bf 6d ad 4e cd ??.????.b??????{-*??R??.?????????.??.-.7????M?? ????h??????m??N??
an example unencrypted data response.
Code:
e1 6f b6 c2 01 00 02 00 03 00 0e 00 61 74 74 72 69 62 75 74 65 4e 61 6d 65 73 07 22 00 0e 00 73 65 72 76 65 72 56 65 72 73 ??o????........attributeNames."...serverVers
69 6f 6e 00 10 00 73 65 72 76 65 72 49 70 41 64 64 72 65 73 73 00 0f 00 73 65 72 76 65 72 48 6f 73 74 50 6f 72 74 00 10 00 ion...serverIpAddress...serverHostPort...
73 65 72 76 65 72 51 75 65 72 79 50 6f 72 74 00 12 00 73 65 72 76 65 72 50 6c 61 79 65 72 43 6f 75 6e 74 00 10 00 73 65 72 serverQueryPort...serverPlayerCount...ser
76 65 72 4c 6f 67 69 6e 4e 61 6d 65 00 10 00 73 65 72 76 65 72 41 64 6d 69 6e 45 6d 61 69 6c 0f 00 73 65 72 76 65 72 41 64 verLoginName...serverAdminEmail..serverAd
6d 69 6e 4e 61 6d 65 11 00 73 65 72 76 65 72 42 75 69 6c 64 4e 75 6d 62 65 72 10 00 73 65 72 76 65 72 46 6c 61 67 43 68 65 minName..serverBuildNumber..serverFlagChe
61 74 73 0e 00 73 65 72 76 65 72 46 6c 61 67 43 6f 6f 70 16 00 73 65 72 76 65 72 46 6c 61 67 4c 65 61 73 65 64 53 65 72 76 ats..serverFlagCoop..serverFlagLeasedServ
65 72 18 00 73 65 72 76 65 72 46 6c 61 67 4f 66 66 69 63 69 61 6c 53 65 72 76 65 72 12 00 73 65 72 76 65 72 46 6c 61 67 50 er..serverFlagOfficialServer..serverFlagP
61 73 73 77 6f 72 64 14 00 73 65 72 76 65 72 46 6c 61 67 50 75 6e 6b 62 75 73 74 65 72 15 00 73 65 72 76 65 72 46 6c 61 67 assword..serverFlagPunkbuster..serverFlag
53 69 6d 75 6e 69 74 69 6f 6e 73 0e 00 73 65 72 76 65 72 46 6c 61 67 56 4f 49 50 0e 00 73 65 72 76 65 72 47 61 6d 65 4e 61 Simunitions..serverFlagVOIP..serverGameNa
6d 65 0e 00 73 65 72 76 65 72 48 6f 73 74 4e 61 6d 65 15 00 73 65 72 76 65 72 48 6f 73 74 4e 61 6d 65 45 6e 63 6f 64 65 64 me..serverHostName..serverHostNameEncoded
0d 00 73 65 72 76 65 72 4d 61 70 4e 61 6d 65 19 00 73 65 72 76 65 72 4d 61 78 50 6c 61 79 65 72 45 78 70 65 72 69 65 6e 63 ..serverMapName..serverMaxPlayerExperienc
65 10 00 73 65 72 76 65 72 4d 61 78 50 6c 61 79 65 72 73 13 00 73 65 72 76 65 72 4d 61 78 53 70 65 63 74 61 74 6f 72 73 19 e..serverMaxPlayers..serverMaxSpectators.
00 73 65 72 76 65 72 4d 69 6e 50 6c 61 79 65 72 45 78 70 65 72 69 65 6e 63 65 11 00 73 65 72 76 65 72 4d 69 73 73 69 6f 6e .serverMinPlayerExperience..serverMission
53 69 7a 65 13 00 73 65 72 76 65 72 4d 69 73 73 69 6f 6e 54 6f 75 72 49 44 11 00 73 65 72 76 65 72 4d 69 73 73 69 6f 6e 54 Size..serverMissionTourID..serverMissionT
79 70 65 14 00 73 65 72 76 65 72 4d 69 73 73 69 6f 6e 56 61 72 69 61 6e 74 15 00 73 65 72 76 65 72 4f 70 65 72 61 74 69 6e ype..serverMissionVariant..serverOperatin
67 53 79 73 74 65 6d 1f 00 73 65 72 76 65 72 51 75 61 6c 69 66 69 63 61 74 69 6f 6e 52 65 71 75 69 72 65 6d 65 6e 74 73 10 gSystem..serverQualificationRequirements.
00 73 65 72 76 65 72 52 65 70 75 74 61 74 69 6f 6e 11 00 73 65 72 76 65 72 53 6b 69 6c 6c 52 61 74 69 6e 67 10 00 73 65 72 .serverReputation..serverSkillRating..ser
76 65 72 53 70 65 63 74 61 74 6f 72 73 0f 00 61 74 74 72 69 62 75 74 65 56 61 6c 75 65 73 07 22 00 06 00 33 2e 30 2e 30 00 verSpectators..attributeValues."...3.0.0.
0e 00 36 38 2e 32 33 32 2e 31 36 31 2e 38 36 00 05 00 38 37 37 37 00 06 00 33 39 33 30 30 00 02 00 30 00 0c 00 67 61 6d 65 ..68.232.161.86...8777...39300...0...game
73 65 72 76 65 72 73 00 03 00 4e 2f 41 03 00 4e 2f 41 09 00 30 34 5f 30 36 31 38 30 39 01 00 30 01 00 30 01 00 31 01 00 31 servers...N/A..N/A..04_061809..0..0..1..1
01 00 30 01 00 31 01 00 30 01 00 31 07 00 5b 45 20 4f 20 44 5d 2b 00 41 6e 6f 74 68 65 72 20 47 61 6d 65 53 65 72 76 65 72 ..0..1..0..1..[E O D]+.Another GameServer
73 2e 63 6f 6d 20 41 41 33 20 53 65 72 76 65 72 20 69 73 20 42 6f 72 6e 21 07 00 5b 45 20 4f 20 44 5d 11 00 49 6d 70 61 63 s.com AA3 Server is Born!..[E O D]..Impac
74 5f 64 61 79 5f 63 6c 6f 75 64 79 09 00 39 39 39 39 39 39 39 39 39 02 00 31 32 01 00 32 01 00 30 05 00 6c 61 72 67 65 03 t_day_cloudy..999999999..12..2..0..large.
00 69 6e 66 02 00 61 6f 04 00 64 65 76 31 07 00 57 69 6e 64 6f 77 73 03 00 41 6e 79 01 00 33 01 00 30 01 00 30 0a 00 72 65 .inf..ao..dev1..Windows..Any..3..0..0..re
73 75 6c 74 43 6f 64 65 02 01 00 00 00 sultCode.....