How to get Infostring from server?


(Superdreadnought) #1

I’m working on a buddytracking system for ET, but i simply dont succeed in getting the infostring from the server …
I tried lots of things like this (perl script)

#!/usr/bin/perl

use IO::Socket;

my $socket = new IO::Socket::INET->new(
   PeerAddr	=> '62.75.215.176',
   PeerPor	=> '27960',
   Proto	=> 'udp',
);

die "Unable to open connection: $!
"
   unless defined $socket;

print $socket "allinfo";

eval {
	while ($socket->recv($reply, 1024)) {
		print $reply;
	}
};

close($socket);

but he simply wont give me a response.

I suppose the allinfo-thingy and all the other things i tried simply dont do the job. My rcon prog works very well, but to make it work u have to submit this string

\377\377\377\377rcon $password $command

(the \377 stands for a specific ANSI-Char)

Any ideas how i can make the server send me the infostring?

THX4YA’HELP!


(Chruker) #2

I’m not sure what you mean by infostring, but in a server viewer script I made, I’m using this php code:

		$cmd_serverinfo = "\xFF\xFF\xFF\xFFgetstatus
";

		fwrite($conn, $cmd_serverinfo);
		$buffer = fread($conn, 100000);

		if (!ereg("\xFF\xFF\xFF\xFFstatusResponse
", $buffer)) {
			$this->error = "Got an unexpected response from the ET server: ".htmlentities($buffer);
			return false;
			}



(dvldrmmr) #3

this is what i used to send an rcon command from a perl script - i changed it from rcon to getstatus like chruker has, should work … i had trouble with this too until i added the “/x00” at the end of the command string, and then it worked … best of luck …

my $command = "\xff\xff\xff\xffgetstatus\x00";
$sock->send($command) or die "send() failed: $!
";

(Superdreadnought) #4

its a shame, buts it doesnt work:

#!/usr/bin/perl

use IO::Socket;

my $socket = new IO::Socket::INET->new(
   PeerAddr	=> '62.75.215.176',
   PeerPor	=> '27960',
   Proto	=> 'udp',
);

die "Unable to open connection: $!
"
   unless defined $socket;

print $socket "\377\377\377\377getstatus
";

while ($socket) {
	#print "
>>> ";
	#chomp(my $command = <STDIN>);
	#for (my $i = 1; $i <= length($command) + 4; $i++) {
	#	print '-';
	#}
	#print "
";

	print $socket "\377\377\377\377getstatus\000";
	
	eval {
		$socket->recv($reply, 1024);
		print $reply;
	};
}

close($socket);


(Chruker) #5

Have you checked if this is a router/firewall issue?


(dvldrmmr) #6

try doing $socket->send(“blahblah”); instead of print $socket “blahblah”; … i never tried the print method, caus the perl book i looked at used send() instead, and send() worked for me …


(Superdreadnought) #7

the print-thingy works fine with my rcon program (and i tried it with the indostring-prog, too - didnt work, simply no response), so it cant be a firewall issue, either, cauz im using the same server.