-
Printable View
-
You could try to send '\FF\FF\FF\FFgetstatus' or '\FF\FF\FF\FFgetinfo' with UDP and store the information that you get back.
A little collection:
Master server list:
RCON:Code:$ 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
getstatusCode:$ 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
--- ----- ---- ------ --------------- ------- --------------------- ----- -----
getinfoCode:
$ 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_hostname\^2K^3~^2DeathRun ^2Rounds ^3: ^23 ^3/ ^210 ^7killtube.org\sv_maxclients\15\sv_maxPing\0\sv_maxRate\0\sv_minPing\0\sv_privateClients\0\sv_punkbuster\0\sv_pure\1\sv_voice\0\pswrd\0\mod\1
getchallengeCode:$ 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
Code:$ echo -e '\xff\xff\xff\xffgetchallenge' | netcat -u 127.0.0.1 28933
ÿÿÿÿchallengeResponse -1508048936
Quote:
http://ftp.iinet.net.au/games/idstuf...ocs/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.
-
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.
It also might be an iptables rule, which is blocking too fast requests (try to sleep() a second before next request to check).
-
-
It does not display the result.PHP Code:
<?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);
}
?>
server exists.
This is the code i made a long time ago.
http://php.net/manual/en/function.fread.phpPHP Code:
$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);
LLLLOOOOOOLLLL!!!!!
thx, Mitch :зPHP Code:
$sendpacket = '........'; //dont true
/////
$sendpacket = "......."; //TRUEEE
Error:
help me!)PHP Code:
Parse error: syntax error, unexpected T_STRING in Z:\xxx\xxx\xxxx\xxxx\xxxxxx.php on line 13
I think that the error in the function explode(); because delimetr "\".PHP Code:
{
$linesinfo = explode("\", $infooservere);
{
echo "Максимальное количество игроков: " . $linesinfo[1];
}
}
" needs to be escaped, hence you need to write "\"", or '"' might work also (with ').
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: ?????
If you want to go over a screen session instead of netcat:
Code:(base) homepc@home-pc:~$ screen -S cod2 -p 0 -X hardcopy ~/tmp_screen.txt; tail -n2 ~/tmp_screen.txt
Server is not running.