如何解决同时重定向和伪造引荐来源网址
| 是否可以将用户重定向到另一个站点并同时伪造引荐来源网址? 我的代码尝试过这个,我知道它是错误的,但是那只是我能走多远。<?php
$page1 = \"http://google.com\"; $page2 = \"http://yahoo.com/\";
$mypages = array($page1,$page2);
$myrandompage = $mypages[mt_rand(0,count($mypages) -1)];
$sites = array_map(\"trim\",file(\"links.txt\"));
$referer = $sites[array_rand($sites)];
function fake_it($url,$ref,$agent)
{
$curl = curl_init();
$header[0] = \"Accept: text/xml,application/xml,application/xhtml+xml,\";
$header[0] .= \"text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\";
$header[] = \"Cache-Control: max-age=0\";
$header[] = \"Connection: keep-alive\";
$header[] = \"Keep-Alive: 300\";
$header[] = \"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\";
$header[] = \"Accept-Language: en-us,en;q=0.5\";
$header[] = \"Pragma: \"; // browsers keep this blank.
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_USERAGENT,$agent);
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl,CURLOPT_REFERER,$ref);
curl_setopt($curl,CURLOPT_ENCODING,\'gzip,deflate\');
curl_setopt($curl,CURLOPT_AUTOREFERER,true);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_TIMEOUT,5000);
$html = curl_exec($curl);
curl_close($curl);
// returns the content provided by the site
return $html;
}
//Below would send a request to the url,with the second parameter as the referrer
echo fake_it($myrandompage,$referer,$_SERVER[\'HTTP_USER_AGENT\']);
?>
我想要的是来自Refer.php-> google.com(referer =其他网址)。
解决方法
您可以做的是将用户重定向到https站点,例如damianb描述+在redirect.php脚本上进行元刷新:
redirect.php :(例如https://www.myurl.com/redirect.php?url=http://www.someotherurl.com)
<?php $destination = $_GET[\'url\']; ?>
<html><head><meta http-equiv=\"refresh\" content=\"0;url=<?php echo $destination; ?>/\"></head><body></body></html>
现在,您可以使用2种武器(https,对于仍发送引荐来源的浏览器:refresh标签)进行战斗。
在RFC 2616中说:
1. \“如果从HTTP安全(HTTPS)连接访问网站,并且链接指向除另一个安全位置以外的任何其他位置,则不会发送引荐来源字段\”
但是,由于这不是完全正确的..不幸的是,您也可以考虑以下情况:
2. \“大多数Web浏览器在被指示使用\” Refresh \“字段重定向时不会发送Referer字段。这不包括某些版本的Opera和许多移动Web浏览器。但是,不建议使用这种重定向方法由万维网联盟(W3C)提供。[7] \“
http://en.wikipedia.org/wiki/HTTP_referrer#Referer_hiding
经过Chrome和Firefox测试。祝好运!
, 我认为您根本无法更改引荐来源。
我唯一了解垃圾引用的方法是使用cURL之类的东西代理页面加载(这是个好主意,很糟糕),或者我相信您可以从HTTPS页面出站访问。
我不确定,但我似乎还记得,出于安全原因,当浏览器来自HTTPS站点时,它们不会发送引荐来源网址。
反复检查。
编辑:根据RFC 2616,当来自HTTPS安全站点时,浏览器不应发送引荐来源网址。
参考:http://tools.ietf.org/html/rfc2616#section-15.1.3
客户端不应该在(非安全的)地址中包含Referer标头字段
HTTP请求(如果引用页面是通过安全的方式传输的)
协议。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。