HTTP-REFERER这个变量已经越来越不可靠了,完全就是可以伪造出来的东东。
以下是伪造方法:
ASP/VisualBasic代码
dimhttp
sethttp=server.createobject(MSXML2.XMLHTTP)'//MSXML2.serverXMLHTTP也可以
Http.openGET,url,false
Http.setRequestHeaderReferer,http://www.dc9.cn/
Http.send()
PHP(前提是装了curl):
PHP代码
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,http://www.dc9.cn/xxx.asp);
curl_setopt($ch,CURLOPT_REFERER,http://www.dc9.cn/);
curl_exec($ch);
curl_close($ch);
PHP(不装curl用sock)
PHP代码
$server='www.dc9.cn';
$host='www.dc9.cn';
$target='/xxx.asp';
$referer='http://www.dc9.cn/';//Referer
$port=80;
$fp=fsockopen($server,$port,$errno,$errstr,30);
if(!$fp)
{
echo$errstr($errno)
\n;
}
else
{
$out=GET$targetHTTP/1.1\r\n;
$out.=Host:$host\r\n;
$out.=Cookie:ASPSESSIONIDSQTBQSDA=DFCAPKLBBFICDAFMHNKIGKEG\r\n;
$out.=Referer:$referer\r\n;
$out.=Connection:Close\r\n\r\n;
fwrite($fp,$out);
while(!feof($fp))
{
echofgets($fp,128);
}
fclose($fp);
}
VB.NET/C#.NET
C#代码
DimoXMLHttpAsMSXML2.XMLHTTP30=NewMSXML2.XMLHTTP30()
或者
MSXML2.XMLHTTP30oXMLHttp=newMSXML2.XMLHTTP30();
oXMLHttp.open(....
oXMLHttp.setRequestHeader(...
oXMLHttp.send(..