之前就知道电信干这个龌龊的事情,那时候据说用的是DNS劫持。Okay,我换OpenDNS。
最近浏览php.net查资料,发现电信的广告还是纷至沓来……
无语之后,默默打开WireShark一探究竟。
发送请求:
GET /manual/en/language.oop5.references.php HTTP/1.1
Host: www.php.net
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091109 Ubuntu/9.10 (karmic) Firefox/3.5.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.php.net/manual/en/langref.php?
回应:
HTTP/1.1 200 OK
Server: Apache/2.0.43 (Unix)
Content-Type: text/html
Expires: Thu, 01 Jan 1970 08:00:01 GMT
Cache-Control: private
Cache-Control: no-cache
Transfer-Encoding: chunked
Connection: close
Date: Sun, 22 Nov 2009 14:59:02 GMT2d2
<html><body scroll=’no’ style=’border:0; margin:0; padding:0;’ id=’mainbody’><iframe src=’about:blank’ width=’100%’ height=’100%’ frameborder=’0′></iframe><script src=’http://121.32.136.21:1010/open.js’></script><script>var content=’http://gd.ct10000.com/yxhd/zp0911.htm?p=1258873142|10619183|2275|850|0|0¶m=ABioyajZGekprCmIW7rLPMyMnMx87Hxr/OyczRmJvZj5CTlpyGlpvCzc3IytmMkIqNnJqKjZPCiIiI0Y+Xj9GRmovQkp6Rip6T0JqR0JOe’;var old_url=’http://www.php.net/manual/en/language.oop5.references.php?’;var param=’350|250|9′;var stat_path = ‘http://121.32.136.2/stat.aspx?p=1258873142|10619183|2275|850|0|0′;try{OpenWin()}catch(e){location.reload(true)}window.setInterval(‘window.status=location.href’, 200)</script></body></html>
0.
<style type=”text/css” media=”print”>
@import url(“http://static.php.net/www.php.net/styles/print.css”);
</style>
<!–[if IE]><![endif]><![endif]–>………………….<省略>
发现:
- HTTP回应头部被插入脚本执行语句。
- 貌似再插入了HTTP分段”Transfer-Encoding: chunked”,原有内容至于一个空段后,貌似会被抛弃。从Firefox的源代码看来,就是只有脚本的内容了。
查看脚本内容(http://121.32.136.21:1010/open.js):
function OpenWin()
{
getParams();
calPosition();
var h = window.open(content, "_blank", styles +
" directories=0, location=0, " +
"menubar=0, resizable=0, scrollbars=0, status=0, titlebar=0, toolbar=0");
if (h)
{
var img = new Image();
img.src = stat_path;
location.href = old_url;
return;
}
....
恩,一手打开新窗口,一手继续重回旧窗口。很好。
解决方法:
貌似还没有很直接的方法。电信要插你,你无法拒绝。Okay,内容上浏览器也无法收到正式内容。唯一想到的办法就是加一个浏览器插件,检测回应内容,如果内容包含有插入广告语句,则重新请求页面……
有更好更懒方法的童鞋,楼下沙发请说。

1 Comment »