my $var1 = sprintf "\x54\x53\x33\x49\x4e\x49\x54\x31\x00\x65\x00\x00\x88\x05\x46\x9e\x28\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
# Second UDP Packet
my $var2 = sprintf "\x90\x58\x0f\x30\xf7\xdd\xdb\x64\x00\x00\x00\x00\x22\x9d\x74\x8b\x45\xaa\x7b\xef\xb9\x9e\xfe\xad\x08\x19\xba\xcf\x41\xe0\x16\xa2\x18\x58\xe4\x98\xf4\xe7\x32\x5e\xe9\xd5\xb2\x29\x2b\x27\xfc\x95\x3e\x71\x02\x9f\x29\x1a\x2d\xc2\x46\xf2\x56\xf4\xf1\x6b\xe7\x7e\xd0\x6a\x70\x99\xaa\x46\xa1\x26\x68\xa2\x3d\x4e\x32\x3b\xe6\x9b\x21\xcc\x73\xb6\xdd\x0a\xbd\xd2\x08\x9d\x81\x5d\x15\xdc\x80\x0b\x08\x41\x5e\x86\x6e\x42\xe2\xf6\x17\x3c\xa9\x8c\x49\xdb\x6e\x92\xe6\xea\x07\xdc\x21\xba\x72\x55\x07\x51\xaf\xdd\xb7\x49\x3b\x33\x2a\x04\xb1\x23\x99\xf6\xe9\x37\x8c\xa2\x4e\xa1\xdd\xb9\x7d\x13\xb6\x37\x29\xa9\x90\x05\x38\xcc\x8b\x8f\x8a\xaa\x8b\xdb\x31\x66\xac\xf6\x9d\x38\x97\x41\xd0\x50\x98\xea\xe1\xee\x5d\x22\xa6\x32\x9a\x28\x68\x58";
# send all the packets!
$ts3_sock->send($var1) or die "Can't send packet no 1: $!";
$ts3_sock->send($var2) or die "Can't send packet no 2: $!";
# waiting for an answer
my ($datagram,$flags);
$ts3_sock->recv($datagram,32,$flags);
# results and exit codes
if($datagram=~/TS3INIT/)
{
print "OK - Teamspeak 3 Server is online (".$host.":".$port.")";
exit(0);
}
elsif($datagram eq "")
{
print "CRITICAL - Teamspeak 3 Server not reachable (".$host.":".$port.")";
exit(2);
}
else
{
print "WARNING - Teamspeak 3 Server returned invalid answer (".$host.":".$port.")";