PDA

View Full Version : Receiving server info



przemekh10
22nd February 2015, 17:31
-

Mitch
22nd February 2015, 18:05
You could try to send '\FF\FF\FF\FFgetstatus' or '\FF\FF\FF\FFgetinfo' with UDP and store the information that you get back.

kung foo man
22nd February 2015, 19:52
A little collection:

Master server list:


$ echo -e "\xFF\xFF\xFF\xFFgetservers 117 full empty" | nc cod2master.activision.com -u 20710
ÿÿÿÿgetserversResponse
\Ù¬²q"\Ù¬²q#\°
ëq1\l=pq \U[Ì\Uc\Dè§Úq \°
ëq9\XÆvq9\EOF


RCON:



$ echo -e '\xff\xff\xff\xffrcon thyPassword status' | netcat -u 127.0.0.1 28933
ÿÿÿÿprint
map: dr_beatwater
num score ping guid name lastmsg address qport rate
--- ----- ---- ------ --------------- ------- --------------------- ----- -----




getstatus




$ echo -e '\xff\xff\xff\xffgetstatus' | netcat -u 127.0.0.1 28933
ÿÿÿÿstatusResponse
\fs_game\dr_v4\g_antilag\1\g_gametype\zom\gamename \Call of Duty 2\mapname\dr_beatwater\protocol\117\shortversion\1 .2\sv_allowAnonymous\0\sv_floodProtect\1\sv_hostna me\^2K^3~^2DeathRun ^2Rounds ^3: ^23 ^3/ ^210 ^7killtube.org\sv_maxclients\15\sv_maxPing\0\sv_ma xRate\0\sv_minPing\0\sv_privateClients\0\sv_punkbu ster\0\sv_pure\1\sv_voice\0\pswrd\0\mod\1


getinfo



$ echo -e '\xff\xff\xff\xffgetinfo' | netcat -u 127.0.0.1 28933
ÿÿÿÿinfoResponse
\protocol\117\hostname\^2K^3~^2DeathRun ^2Rounds ^3: ^23 ^3/ ^210 ^7killtube.org\mapname\dr_beatwater\sv_maxclients\ 15\gametype\zom\pure\1\game\dr_v4\kc\1\hw\1\mod\1\ voice\0\pb\-4598016


getchallenge



$ echo -e '\xff\xff\xff\xffgetchallenge' | netcat -u 127.0.0.1 28933
ÿÿÿÿchallengeResponse -1508048936




http://ftp.iinet.net.au/games/idstuff/quake3/docs/server.txt
"getstatus" responds with all the info that qplug or qspy can see about the server and all connected players. Used for getting detailed information after the simple info query. It is sent along with a challenge string. The server will respond with a "getstatusResponse" packet.

"getinfo" responds with a short info message that should be enough to determine if a user is interested in a server to do a full status. It is also sent with a challenge string.

"getchallenge" returns a challenge number that can be used in a subsequent connectResponse command. We do this to prevent denial of service attacks that flood the server with invalid connection IPs. With a challenge, they must give a valid IP address. The server will respond with a "challengeResponse" packet.

"connect" is the first step in a client connecting to a server. You send the "connect" string followed by the infoString containing the protocol version of the client, the qport, the challenge string (obtained via getchallenge), and the userinfo.

"rcon" is a remote command to the server. It's sent as "rcon" followed by the server password, followed by the command string to be executed.

przemekh10
28th February 2015, 15:23
-

Mitch
28th February 2015, 16:42
In which language is it written? And how do you handle the response? Also a bit of code how sendRequest works would be nice too.

kung foo man
28th February 2015, 17:43
It also might be an iptables rule, which is blocking too fast requests (try to sleep() a second before next request to check).

przemekh10
3rd March 2015, 21:01
-

przemekh10
13th March 2015, 19:25
-

Mitch
13th March 2015, 19:35
How to get number and names of all players playing on the server without having password?

'getstatus' and 'getinfo' should contain the players list. But it doesn't mean player #0 is slot #0.

maxdamage99
4th May 2015, 22:01
<?php

{
$server_ip = '94.142.139.251';
$server_port = '28960';

$server_info = "udp://" . $server_ip;
@$connectpacket = fsockopen($server_info, $server_port, $re, $errstr, 2);
if(!$connectpacket)
{
die('Нету подключения к серверу/Или сервер несуществует!'); //server die, offline
}
global $server_ip, $server_port;
$sendpacket = '\xff\xff\xff\xffgetstatus';
fwrite($connectpacket, $sendpacket);
socket_set_timeout($connectpacket, 2);
$otvet = fread($connectpacket, 15000);
if($otvet=='яяяяdisconnect') { die('не удалось подключение, или данные не получены!?'); } //dont results
echo $otvet;
sleep(1);
}

?>


It does not display the result.
server exists.

maxdamage99
5th May 2015, 19:06
<?php

{
$server_ip = '94.142.139.251';
$server_port = '28960';

$server_info = "udp://" . $server_ip;
@$connectpacket = fsockopen($server_info, $server_port, $re, $errstr, 2);
if(!$connectpacket)
{
die('Нету подключения к серверу/Или сервер не существует!'); //server die, offline
}
global $server_ip, $server_port;
$sendpacket = '\xff\xff\xff\xffgetstatus';
fwrite($connectpacket, $sendpacket);
socket_set_timeout($connectpacket, 2);
$otvet = fread($connectpacket, 15000);
if($otvet=='яяяяdisconnect') { die('не удалось подключение, или данные не получены!?'); } //dont results
echo $otvet;
sleep(1);
}

?>


It does not display the result.
server exists.
Sry, in the required subject, no one reads :с

Mitch
5th May 2015, 21:03
This is the code i made a long time ago.


$errno = $errstr = null;
$cmd = "\xFF\xFF\xFF\xFFgetstatus";
$f = fsockopen('udp://' . $ip, $port, $errno, $errstr, $timeout);
if (!$f)
die ("Unable to connect. Error $errno - $errstr\n");
socket_set_timeout ($f, 1, 0);
fwrite ($f, $cmd);
$data = '';
while ($d = fread ($f, 10000)) {
$data .= $d;
}
fclose ($f);


http://php.net/manual/en/function.fread.php

maxdamage99
6th May 2015, 13:23
LLLLOOOOOOLLLL!!!!!


$sendpacket = '........'; //dont true
/////
$sendpacket = "......."; //TRUEEE


thx, Mitch :з

maxdamage99
6th May 2015, 20:01
Error:


Parse error: syntax error, unexpected T_STRING in Z:\xxx\xxx\xxxx\xxxx\xxxxxx.php on line 13

help me!)


{
$linesinfo = explode("\", $infooservere);
{
echo "Максимальное количество игроков: " . $linesinfo[1];
}

}

I think that the error in the function explode(); because delimetr "\".

kung foo man
6th May 2015, 20:11
" needs to be escaped, hence you need to write "\"", or '"' might work also (with ').

maxdamage99
6th May 2015, 21:20
I solved this problem, and now I need to get information on the current number of players on the server ?? What cmd i can do it?
info maxclients: sv_maxclients.
info map: mapname.
info name server: sv_hostname.
info сurrently, the number of players on the server: ?????

maxdamage99
10th May 2015, 11:29
I solved this problem, and now I need to get information on the current number of players on the server ?? What cmd i can do it?
info maxclients: sv_maxclients. (30)
info map: mapname.
info name server: sv_hostname.
info сurrent player: ????? (5/30)
sry bad english.