Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 16:28

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: Enctype2 - trying to get not only server list...
PostPosted: 06 Oct 2008 20:11 

Joined: 06 Oct 2008 19:34
Posts: 6
Location: Czech Republic
Good evening,
I've got a small puzzle I cannot solve and I didn't found any solution for it :) I'm using C# port of Gslist. It works very well (big thanks), but... It returns only server list. But I'd like to command GameSpy server to return something else than only server list, because if I want to get more information directly from the game servers, some of them will respond and some of them will not :( And I haven't found way to get some other data... If I modified string which is sending to the GS server (e.g. added \hostname\), I've got:
1) the same result - server list
2) some non-readable chars
3) nothing - GS server didn't respond.

I've copied the string which is sending to the GS server... Is it possible to modificate it to suit my needs? :-/

\basic\gamename\worms4\enctype\2\location\0\where\\validate\<validate code>\final\list\\gamename\worms4\final\

Thank you very much!


Last edited by Paulos on 09 Nov 2008 11:45, edited 1 time in total.

Top
 Profile  
 
 
 Post subject: Re: Gslist - trying to get not only server list...
PostPosted: 06 Oct 2008 21:19 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
what you need is enctypeX.
at the moment exists only the C# port of enctype2 (not Gslist which is a completely different project), so enctypeX is available only for C.
Anyway you can compile enctypex_decoder.c as a DLL and using it in your project.

at the beginning enctypeX is not very easy to use for some technical reasons (the name of the master server is gamename based, the connection is not closed by the master server so is needed to decrypt and parse the incoming data in real-time, parsing each single server's information and so on) and because I have written it with Gslist in mind, but if you need some help in using it take a look to the enctypex* functions used in gslist.c or to the following code which performs the decryption of a file containing the raw data received from the master server:

http://aluigi.org/papers/enctypedec.zip

then the parsing of the decrypted data is performed by the enctypex_decoder_convert_to_ipport function which can store the informations available for each server (each server, so if there are 1000 servers the function must be called 1000 times) into a simple buffer passed by the developer using the format "IP:port \parameter1\value1\parameter2\value2\...\parameterN\valueN"... anyway it's probably more easy to watch the for(;;) at line 1235 of gslist.c.


Top
 Profile  
 
 Post subject: Re: Gslist - trying to get not only server list...
PostPosted: 07 Oct 2008 12:26 

Joined: 06 Oct 2008 19:34
Posts: 6
Location: Czech Republic
OK, very big thanks, I'll probably use that enctypex_decoder - but I will need to compile it to DLL. That could be a problem because I'm not programming in C or C++...


Top
 Profile  
 
 Post subject: Re: Gslist - trying to get not only server list...
PostPosted: 07 Oct 2008 12:33 

Joined: 06 Oct 2008 19:34
Posts: 6
Location: Czech Republic
(i'm devil, this is C, no C++ :D)

So, I've compiled the DLL successfully, I'll try to test it now.

And, of course, I made mistake in that name ;) sorry


Top
 Profile  
 
 Post subject: Re: Gslist - trying to get not only server list...
PostPosted: 09 Nov 2008 11:44 

Joined: 06 Oct 2008 19:34
Posts: 6
Location: Czech Republic
I'm trying to get that DLL to work more than month and I don't know what is the problem. I cannot even compile my latest experiments.
The problem is:
Code:
326   unsigned char __stdcall *enctypex_decoder(unsigned char *key, unsigned char *validate, unsigned char *data, int *datalen, enctypex_data_t *enctypex_data) {

...
Code:
364   unsigned char __stdcall *enctypex_msname (unsigned char *gamename, unsigned char *retname) {


1>.\eXd.c(326) : error C2165: 'left-side modifier' : cannot modify pointers to data
1>.\eXd.c(364) : error C2165: 'left-side modifier' : cannot modify pointers to data

and I dunno how to get it to work properly because I'm not programming in C. I have one book here, but there isn't one word about creation of dynamic libraries, only static ones.
I've even tried many kinds of brackets, but with no success.

Can you please help me with this?


Top
 Profile  
 
 Post subject: Re: Enctype2 - trying to get not only server list...
PostPosted: 09 Nov 2008 15:47 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
__stdcall is used mainly for the Windows APIs, so you should remove it.
while for the rest you can try to place a "static" before these functions (probably it helps on some compilers, probably not).


Top
 Profile  
 
 Post subject: Re: Gslist - trying to get not only server list...
PostPosted: 09 Nov 2008 21:58 

Joined: 09 Nov 2008 21:56
Posts: 1
aluigi wrote:
what you need is enctypeX.
at the moment exists only the C# port of enctype2 (not Gslist which is a completely different project), so enctypeX is available only for C.
Anyway you can compile enctypex_decoder.c as a DLL and using it in your project.

at the beginning enctypeX is not very easy to use for some technical reasons (the name of the master server is gamename based, the connection is not closed by the master server so is needed to decrypt and parse the incoming data in real-time, parsing each single server's information and so on) and because I have written it with Gslist in mind, but if you need some help in using it take a look to the enctypex* functions used in gslist.c or to the following code which performs the decryption of a file containing the raw data received from the master server:

http://aluigi.org/papers/enctypedec.zip

then the parsing of the decrypted data is performed by the enctypex_decoder_convert_to_ipport function which can store the informations available for each server (each server, so if there are 1000 servers the function must be called 1000 times) into a simple buffer passed by the developer using the format "IP:port \parameter1\value1\parameter2\value2\...\parameterN\valueN"... anyway it's probably more easy to watch the for(;;) at line 1235 of gslist.c.

By any chance do you have an example input file, I can't seen to get it to work.


Top
 Profile  
 
 Post subject: Re: Enctype2 - trying to get not only server list...
PostPosted: 09 Nov 2008 23:35 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
attached.

enctypedec -g Xn221z x wot_enctypex.txt

and the resulted server's list is:
137.28.20.118 7778
75.93.25.227 7778
69.12.92.190 7778
69.12.92.14 7778

edit: the attached file contains both my data (the first 34 bytes) and the server's data (from offset 0x22) so you can see everything


Attachments:
wot_enctypex.txt [105 Bytes]
Downloaded 133 times
Top
 Profile  
 
 Post subject: Re: Enctype2 - trying to get not only server list...
PostPosted: 06 Dec 2008 14:05 

Joined: 06 Oct 2008 19:34
Posts: 6
Location: Czech Republic
This:
Q??<??d ???vbK]??bE \??bE \b ????????
cannot be IP list :) I think someone forgot to include validate key - or is it necessary? And I have 2 additional questions:
1) there is enctypex_decoder_rand_validate(char validate) function - but it is void, how is it working? I'm now finding a way how to get a validation key.
2) what is sending to the worms4.ms4.gamespy.com:28910 server? Something like worms4.worms4.Dhzr>dg\hostname\mapname\scheme\password\ ? Or what? (I assume it is TCP connection...)

BTW, DLL is working so far...


Top
 Profile  
 
 Post subject: Re: Enctype2 - trying to get not only server list...
PostPosted: 06 Dec 2008 15:59 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
why that sequence of bytes can't be an IP list?
gamespy returns binary data not textual (like 1.2.3.4:1234) so it's normal.
if you have used enctypedec with the file I attached you don't need to specify the validate key because the tool automatically gets it from the dump.

1) that function is a function I wrote for generating a pseudo-random string, it accepts only one argument and is a buffer of at least 9 bytes like:
char string[9];
enctypex_decoder_rand_validate(string);

2)
Code:
00 46 00 01 03 00 00 00 00 77 6f 72 6d 73 34 00   .F.......worms4.
67 73 6c 69 76 65 00 65 2e 39 7b 52 4d 5c 2f 00   gslive.e.9{RM\/.
5c 68 6f 73 74 6e 61 6d 65 5c 6d 61 70 6e 61 6d   \hostname\mapnam
65 5c 73 63 68 65 6d 65 5c 70 61 73 73 77 6f 72   e\scheme\passwor
64 00 00 00 00 01                                 d.....
naturally you can substituite gslive with worms4 if you want to use its gamekey, in this case the dump will be like:
Code:
00 46 00 01 03 00 00 00 00 77 6f 72 6d 73 34 00   .F.......worms4.
77 6f 72 6d 73 34 00 35 24 57 3e 28 4b 62 6c 00   worms4.5$W>(Kbl.
5c 68 6f 73 74 6e 61 6d 65 5c 6d 61 70 6e 61 6d   \hostname\mapnam
65 5c 73 63 68 65 6d 65 5c 70 61 73 73 77 6f 72   e\scheme\passwor
64 00 00 00 00 01                                 d.....
gamekey Bs28Kl


Top
 Profile  
 
 Post subject: Re: Enctype2 - trying to get not only server list...
PostPosted: 06 Dec 2008 17:56 

Joined: 06 Oct 2008 19:34
Posts: 6
Location: Czech Republic
Aha, binary data - sorry, I didn't realized that.

1) Yes, I thought it is this. So pseudo-random string? 8 characters long? That's good, one problem down.
2) It's so simple? Thank you very much!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: