Advertisement
Advertisement
| 01.20.2008 at 08:34PM PST, ID: 23097462 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: |
<?php
@set_time_limit(256);
class PServer
{
var $svr;
var $os;
var $type;
var $hits;
var $usrs;
var $max;
var $http;
var $ver;
function GetServerInfo($host, $port)
{
if ($fp = @fsockopen($host, $port, $errno, $errstr, 5))
{
$prcl = @unpack("L*", @fread($fp, 1024));
$this->hits = $prcl[3];
$this->type = ($prcl[1] == 0x74697972 ? 0 : 1); // ryit = Intel, tiyr = Motorola
$t = ($this->type ? "N" : "V");
@fputs($fp, @pack("{$t}*", 0x73496E66, 0x10, $this->hits, 0x7E, 0x54595045, 0x04, 0x4A617661)); // sInf
$prcl = $this->PopStack("{$t}3", @fread($fp, 1024), 12);
if ($prcl[1] == 0x73496E66 && $prcl[3] == $this->hits) // sInf
{
while ($prcl[2])
{
$prcl = $this->PopStack("{$t}2", @end($prcl), 8);
$prot = $prcl[1];
$prcl = $this->PopStack("", @end($prcl), $prcl[2]);
$prcl[1] = @preg_replace("#\'#", "\\\'", $prcl[1]);
switch($prot)
{
case 0x4E414D45: // NAME // $prcl[1]
$chars_to_htmlent = array(
'¬' => '€',
'?' => '',
'' => '‚',
'' => 'ƒ',
'' => '„',
'&' => '…',
' ' => '†',
'!' => '‡',
'Æ' => 'ˆ',
'0' => '‰',
'`' => 'Š',
'9' => '‹',
'R' => 'Œ',
'?' => '',
'}' => 'Ž',
'?' => '',
'?' => '',
'' => '‘',
'' => '’',
'' => '“',
'' => '”',
'"' => '•',
'' => '–',
'' => '—',
'Ü' => '˜',
'"' => '™',
'a' => 'š',
':' => '›',
'S' => 'œ',
'?' => '',
'~' => 'ž',
'x' => 'Ÿ');
$this->svr = strtr(htmlentities($prcl[1]), $chars_to_htmlent);
break;
case 0x4855524C: // HURL
$this->http = $prcl[1];
preg_match("/http:\/\/(.*)\/media\//", $this->http, $matches);
$this->user = $matches[1];
break;
case 0x4E555352: // NUSR
$this->usrs = @end(@unpack("{$t}1", $prcl[1]));
break;
}
}
}
print "$this->usrs <a href='palace://$this->user:$port'>$this->svr</a> <BR>\n";
//$packet = 0x20657962000000002E000000;
//fwrite($fp,$packet);
fclose($fp);
return TRUE;
} else {
return FALSE;
}
}
function PopStack($format = "", $data = "", $size = 0)
{
if ($format)
{
$ary = @unpack($format, $data);
$ary[] = @substr($data, $size);
} else {
$ary = @array(1 => @substr($data, 0, $size), 2 => @substr($data, $size));
}
if (@count($ary))
{
return $ary;
}
}
}
$pserver = new PServer;
$pserver->GetServerInfo("38.101.159.2", "5555");
print "----------- AWAITING IP ---------<BR>\n";
?>
|