本帖最后由 fcerebel 于 2011-6-20 18:55 编辑
半夜睡不着,就上一会网
打开卡饭的一个页面,突然...........
诶,这不是宽带公司的页面劫持广告吗?几个月前,宽带公司的客服已经清清楚楚地表示会禁止向我的宽带投放这类广告的。
反正先看页面源代码,结论是没有发现可以联系到宽带公司的内容
接下来,再看页面中的媒体
原来是QQ互联诶
那啥
我没加入QQ互联
我也不愿意使用QQ互联
我甚至屏蔽了检查是否follow疼讯官方微博帐号的脚本
疼讯你居然还要向我推送信息?
我说,
你只可以给希望使用QQ互联的人提供该功能,对于那些不希望使用的人,必须由你给出关闭/禁用选项,而不是我们被动地筛选、删除
----------------------------------------------------------------------------------
接下来,发现这个信息推送功能应该是基于以下分析的统计脚本,所以,无论弹不弹出窗口,只要你访问了kafan.cn,这个统计脚本一定是有的,只是你看不见/没注意而已
----------------------------------------------------------------------------------
然后看了一下noscript,发现有个来自qq的脚本
看到了吧:
好了,从此以后,不管你有没有加入qq互联,你在卡饭的一举一动,疼讯都知道
脚本地址
http://tcss.qq.com/ping.js
以下是脚本:
这个脚本的换行符有些问题,所以用http://jsbeautifier.org/分了下行,可以大致看清楚
我不懂javascript,所以这里只能给出一些"一眼就能看出来的"分析
目前为止,这个脚本的功能,似乎和其它第三方统计没有明显的不同,它似乎仅用于discuz论坛
关于第三方统计,请查看我在http://bbs.kafan.cn/thread-934196-1-1.html的介绍
但是,这里是一个论坛,和一般网页不同,你上新浪看新闻的时候,是匿名的,新浪只能不可追溯地知道你是谁:它可以知道你大概是住在宣武区的网通用户,白天会到中关村上班,上班的公司是在用电信的线路,它能知道你每天什么时候看新闻,对哪些新闻感兴趣。
你上卡饭的时候,你是用卡饭/qq帐号登录的,就有一个固定身份可追寻了:
腾讯知道你的kafan账户(以及其它DZ论坛账户),你的腾讯微博账户(自然包括qq账户),以及你与qq好友之间的关系等信息之间的关联
而在国内,知道了这些,基本上就相当于知道你是谁了
这是最大风险,一切都在腾讯的投影之下
也许你需要考虑一下,使用这个可能是不必要的内容,你承担得了其中的风险吗?
反之,现在你手头有各种现成的工具,从XX卫士到浏览器插件到本地DNS劫持,你可以很简单、不用付出什么代价就能把它请出你的电脑。
还有一个猜测:
另一方面,潜在地,这个脚本同样可以用于推送精确广告- (function () {
- var _d, _l, _b, _n = "-",
- _params, _curDomain, _curUrl, _domainToSet, _refDomain, _refUrl, _image;
- var _v = 0;
- if (typeof (_rep) == "undefined") {
- var _rep = 1
- }
- function tcss(params) {
- this.url = [];
- this.init(params)
- }
- tcss.prototype = {
- init: function (params) {
- params ? _params = params : _params = {};
- _d = document;
- if (!(_params.statIframe)) {
- if (window != top) {
- try {
- _d = top.document
- } catch (e) {}
- }
- }
- _l = _d.location;
- _b = _d.body
- },
- getInterfaceInfo: function () {
- var _dP = "";
- if (_params.discuzParams) {
- if (_params.discuzParams.ui) {
- _dP += "&ui=" + _params.discuzParams.ui
- } else {
- _dP += "&ui=0"
- }
- if (_params.discuzParams.ty) {
- _dP += "&ty=" + _params.discuzParams.ty
- } else {
- _dP += "&ty=" + _v
- }
- if (_params.discuzParams.fi) {
- _dP += "&fi=" + _params.discuzParams.fi
- }
- if (_params.discuzParams.gi) {
- _dP += "&gi=" + _params.discuzParams.gi
- }
- if (_params.discuzParams.ti) {
- _dP += "&ti=" + _params.discuzParams.ti
- }
- if (_params.discuzParams.pi) {
- _dP += "&pi=" + _params.discuzParams.pi
- }
- if (_params.discuzParams.rt) {
- _dP += "&rt=" + _params.discuzParams.rt
- }
- if (_params.discuzParams.md) {
- _dP += "&md=" + _params.discuzParams.md
- }
- if (_params.discuzParams.nt) {
- _dP += "&nt=" + _params.discuzParams.nt
- }
- if (_params.discuzParams.pn) {
- _dP += "&pn=" + _params.discuzParams.np
- }
- if (_params.discuzParams.qq) {
- _dP += "&qq=" + _params.discuzParams.qq
- }
- if (_params.discuzParams.on) {
- _dP += "&on=" + _params.discuzParams.on
- }
- if (_params.discuzParams.r2) {
- _dP += "&r2=" + _params.discuzParams.r2
- }
- if (_params.discuzParams.logo) {
- this.ctrlLogo(_params.discuzParams.logo)
- }
- }
- return _dP
- },
- # 首先,这个家伙是用来统计的
- ctrlLogo: function (c_params) {
- var src, style, swi = c_params ? c_params : 1;
- switch (swi) {
- case 0:
- break;
- case 9:
- src = "腾讯分析";
- style = "word";
- break;
- case 10:
- src = "网站统计";
- style = "word";
- break;
- default:
- src = "http://tcss.qq.com/icon/toss_" + swi + ".gif";
- style = "pic";
- break
- }
- this.creatLogo(style, src)
- },
- creatLogo: function (style, src) {
- var child, sonChild, phParent = document.getElementById("tcss").parentNode;
- child = document.createElement("a");
- child.href = "http://stats.discuz.qq.com";
- child.title = "腾讯分析";
- child.target = "_blank";
- switch (style) {
- case "word":
- var text = document.createTextNode(src);
- child.appendChild(text);
- break;
- case "pic":
- sonChild = document.createElement("img");
- sonChild.title = "腾讯分析";
- sonChild.src = src;
- sonChild.border = 0;
- child.appendChild(sonChild);
- break;
- default:
- break
- }
- phParent.replaceChild(child, document.getElementById("tcss"))
- },
- run: function () {
- if (_cookie.get("pgv_pvi=", true) == _n) {
- _v = 1
- }
- _cookie.init();
- this.url.push(this.getDomainInfo());
- this.url.unshift("http://pingtcss.qq.com/pingd?");
- this.url.push(this.getRefInfo(_params));
- #先设置一个cookie,以后疼讯就记住你是谁了
- try {
- if (navigator.cookieEnabled) {
- this.url.push("&pvi=" + _cookie.setCookie("pgv_pvi", true))
- } else {
- this.url.push("&pvi=NoCookie")
- }
- } catch (e) {
- this.url.push("&pvi=NoCookie")
- }
- this.url.push("&si=" + _cookie.setCookie("ssi"));
- this.url.push(this.getInterfaceInfo());
- this.url.push(this.getMainEnvInfo());
- this.url.push(this.getExtendEnvInfo());
- if (_params.userDefineVariable) {
- this.url.push(_udv.setv(_params.userDefineVariable))
- }
- _cookie.save();
- if (_params.originalReferer) {
- this.url.push("&or=" + _params.originalReferer)
- }
- if (_params.extraParams) {
- this.url.push("&ext=" + _params.extraParams)
- }
- this.sendInfo(this.url.join(""));
- if (_params.hot) {
- if (document.attachEvent) {
- document.attachEvent("onclick", function (event) {
- pgvWatchClick(event)
- })
- } else {
- document.addEventListener("click", function (event) {
- pgvWatchClick(event)
- }, false)
- }
- }
- if (_params.repeatApplay && _params.repeatApplay == "true") {
- if (typeof (_rep) != "undefined") {
- _rep = 1
- }
- }
- },
- #记录你在访问哪个网站
- getDomainInfo: function (hot) {
- var dm, url;
- _curDomain = dm = _params.virtualDomain || _l.host;
- dm = _curDomain.toLowerCase();
- if (!_domainToSet) {
- _domainToSet = this.getCookieSetDomain()
- }
- if (hot) {
- var pl = dm.indexOf(":");
- if (pl > -1) {
- dm = dm.substr(0, pl) + ".hot" + dm.substr(pl)
- } else {
- dm += ".hot"
- }
- }
- url = this.getCurrentUrl();
- return ("dm=" + dm + "&url=" + url)
- },
- getCurrentUrl: function () {
- var url = "";
- var arg = _n;
- if (_params.virtualURL) {
- url = _params.virtualURL
- } else {
- url = _curUrl = escape(_l.pathname);
- if (_l.search != "") {
- arg = escape(_l.search.substr(1))
- }
- if (_params.senseParam) {
- var value = this.getParameter(_params.senseParam, _d.URL);
- if (value) {
- url += "_" + value
- }
- }
- }
- return url + "&arg=" + arg
- },
- getRefInfo: function (params) {
- var refdm = _n,
- refurl = _n,
- refarg = _n,
- refStr = _d.referrer,
- tagParamName, adtag, pos;
- var ADTAG = _n;
- var virtualDomain = params.virtualDomain ? params.virtualDomain : _n;
- var virtualURL = params.virtualURL ? params.virtualURL : _n;
- _refDomain = params.virtualRefDomain ? params.virtualRefDomain : "";
- _refUrl = params.virtualRefURL ? params.virtualRefURL : "";
- tagParamName = params.tagParamName || "ADTAG";
- adtag = this.getParameter(tagParamName, _d.URL);
- if (adtag) {
- ADTAG = adtag
- }
- pos = refStr.indexOf("://");
- if (pos > -1) {
- var re = /(\w+):\/\/([^\:|\/]+)(\:\d*)?(.*\/)([^#|\?|\n]+)?(#.*)?(\?.*)?/i;
- var arr = refStr.match(re);
- if (arr) {
- refdm = arr[2];
- refurl = arr[4] + arr[5]
- }
- }
- if (refStr.indexOf("?") != -1) {
- var pos = refStr.indexOf("?") + 1;
- refarg = refStr.substr(pos)
- }
- if (_refDomain != "" && params.useCookie == "false") {
- refdm = _refDomain
- }
- if (_refUrl != "" && params.useCookie == "false") {
- refurl = _refUrl
- }
- _refDomain = refdm;
- _refUrl = escape(refurl);
- return ("&rdm=" + _refDomain + "&rurl=" + _refUrl + "&adt=" + ADTAG + "&rarg=" + escape(refarg))
- },
- #你的浏览器的各项(公开)设置
- getMainEnvInfo: function () {
- var ret = "";
- try {
- var scr = _n,
- scl = _n,
- lang = _n,
- cpuc = _n,
- pf = _n,
- tz = _n,
- java = 0,
- n = navigator;
- if (self.screen) {
- scr = screen.width + "x" + screen.height;
- scl = screen.colorDepth + "-bit"
- }
- if (n.language) {
- lang = n.language.toLowerCase()
- } else {
- if (n.browserLanguage) {
- lang = n.browserLanguage.toLowerCase()
- }
- }
- java = n.javaEnabled() ? 1 : 0;
- pf = n.platform;
- tz = new Date().getTimezoneOffset() / 60;
- ret = "&scr=" + scr + "&scl=" + scl + "&lg=" + lang + "&jv=" + java + "&pf=" + pf + "&tz=" + tz
- } catch (e) {} finally {
- return ret
- }
- },
- getExtendEnvInfo: function () {
- var ret = "";
- try {
- var flash, currentUrl = _l.href,
- connectType = _n;
- ret += "&fl=" + this.getFlashInfo();
- if (_b.addBehavior) {
- _b.addBehavior("#default#homePage");
- if (_b.isHomePage(currentUrl)) {
- ret += "&hp=Y"
- }
- }
- if (_b.addBehavior) {
- _b.addBehavior("#default#clientCaps");
- connectType = _b.connectionType
- }
- ret += "&ct=" + connectType
- } catch (e) {} finally {
- return ret
- }
- },
- getFlashInfo: function () {
- var f = _n,
- n = navigator;
- try {
- if (n.plugins && n.plugins.length) {
- for (var i = 0; i < n.plugins.length; i++) {
- if (n.plugins[i].name.indexOf("Shockwave Flash") > -1) {
- f = n.plugins[i].description.split("Shockwave Flash ")[1];
- break
- }
- }
- } else {
- if (window.ActiveXObject) {
- for (var i = 12; i >= 5; i--) {
- try {
- var fl = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + i + "');");
- if (fl) {
- f = i + ".0";
- break
- }
- } catch (e) {}
- }
- }
- }
- } catch (e) {}
- return f
- },
- getParameter: function (name, src) {
- if (name && src) {
- var r = new RegExp("(\\?|#|&)" + name + "=([^&^#]*)(#|&|$)");
- var m = src.match(r);
- return m ? m[2] : ""
- }
- return ""
- },
- getCookieSetDomain: function () {
- var dotlen, pos, domainToSet, dot = [],
- j = 0;
- for (var i = 0; i < _curDomain.length; i++) {
- if (_curDomain.charAt(i) == ".") {
- dot[j] = i;
- j++
- }
- }
- dotlen = dot.length;
- pos = _curDomain.indexOf(".cn");
- if (pos > -1) {
- dotlen--
- }
- domainToSet = "qq.com";
- if (dotlen == 1) {
- domainToSet = _curDomain
- } else {
- if (dotlen > 1) {
- domainToSet = _curDomain.substring(dot[dotlen - 2] + 1)
- }
- }
- return domainToSet
- },
- #这是最危险的地方:它会记录你在卡饭上的一切点击、一切输入情况,这个点击好像还是精确到像素的;但是会不会把你输入的内容发给腾讯,我看不出来
- watchClick: function (e) {
- try {
- var istag = true,
- hottag = "",
- srcElement;
- srcElement = window.event ? window.event.srcElement : e.target;
- switch (srcElement.tagName) {
- case "A":
- hottag = "<A href=" + srcElement.href + ">" + srcElement.innerHTML + "</a>";
- break;
- case "IMG":
- hottag = "<IMG src=" + srcElement.src + ">";
- break;
- case "INPUT":
- hottag = "<INPUT type=" + srcElement.type + " value=" + srcElement.value + ">";
- break;
- case "BUTTON":
- hottag = "<BUTTON>" + srcElement.innerText + "</BUTTON>";
- break;
- case "SELECT":
- hottag = "SELECT";
- break;
- default:
- istag = false;
- break
- }
- if (istag) {
- var t = new tcss(_params);
- var pos = t.getElementPos(srcElement);
- var scr, scl;
- if (_params.coordinateId) {
- var coordinatePos = t.getElementPos(document.getElementById(_params.coordinateId));
- pos.x -= coordinatePos.x
- }
- t.url.push(t.getDomainInfo(true));
- t.url.push("&ht=" + escape(hottag));
- t.url.push("&x=" + pos.x);
- t.url.push("&y=" + pos.y);
- if (self.screen) {
- scr = screen.width + "x" + screen.height;
- scl = screen.colorDepth + "-bit";
- t.url.push("&scr=" + scr + "&scl=" + scl)
- }
- t.url.push("&rand=" + Math.round(Math.random() * 100000));
- t.url.unshift("http://pinghot." + _domainToSet + "/pingd?");
- t.sendInfo(t.url.join(""))
- }
- } catch (ex) {}
- },
- getElementPos: function (el) {
- if (el.parentNode === null || el.style.display == "none") {
- return false
- }
- var ua = navigator.userAgent.toLowerCase(),
- parent = null,
- pos = [],
- box;
- if (el.getBoundingClientRect) {
- var scrollTop, scrollLeft, clientTop, clientLeft;
- box = el.getBoundingClientRect();
- scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
- scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
- clientTop = document.body.clientTop;
- clientLeft = document.body.clientLeft;
- return {
- x: box.left + scrollLeft - clientLeft,
- y: box.top + scrollTop - clientTop
- }
- } else {
- if (document.getBoxObjectFor) {
- box = document.getBoxObjectFor(el);
- var borderLeft = (el.style.borderLeftWidth) ? Math.floor(el.style.borderLeftWidth) : 0;
- var borderTop = (el.style.borderTopWidth) ? Math.floor(el.style.borderTopWidth) : 0;
- pos = [box.x - borderLeft, box.y - borderTop]
- } else {
- pos = [el.offsetLeft, el.offsetTop];
- parent = el.offsetParent;
- if (parent != el) {
- while (parent) {
- pos[0] += parent.offsetLeft;
- pos[1] += parent.offsetTop;
- parent = parent.offsetParent
- }
- }
- if (ua.indexOf("opera") > -1 || (ua.indexOf("safari") > -1 && el.style.position == "absolute")) {
- pos[0] -= document.body.offsetLeft;
- pos[1] -= document.body.offsetTop
- }
- }
- }
- if (el.parentNode) {
- parent = el.parentNode
- } else {
- parent = null
- }
- while (parent && parent.tagName != "BODY" && parent.tagName != "HTML") {
- pos[0] -= parent.scrollLeft;
- pos[1] -= parent.scrollTop;
- if (parent.parentNode) {
- parent = parent.parentNode
- } else {
- parent = null
- }
- }
- return {
- x: pos[0],
- y: pos[1]
- }
- },
- sendClick: function () {
- if (_params.hottag) {
- this.url.push(this.getDomainInfo(true));
- this.url.push("&ht=" + escape(_params.hottag));
- this.url.push("&x=9999&y=9999");
- this.url.push("&rand=" + Math.round(Math.random() * 100000));
- this.url.unshift("http://pinghot." + _domainToSet + "/pingd?");
- this.sendInfo(this.url.join(""))
- }
- },
- sendInfo: function (url) {
- _image = new Image(1, 1);
- _image.src = url
- }
- };
- var _udv = {
- vscope: {
- page: 3,
- session: 2,
- user: 1
- },
- setv: function (tuple) {
- var params = _n;
- var val = _n;
- if (!tuple || !tuple.name || tuple.name == "" || !tuple.value || tuple.value == "" || !tuple.scope || tuple.scope < 1 || tuple.scope > 3) {
- val = _cookie.get(tuple.name + "=") == _n ? _cookie.get(tuple.name + "=", true) : _cookie.get(tuple.name + "=");
- if (_n != val) {
- params = "&" + tuple.name + "=" + tuple.value
- }
- } else {
- var val = tuple.name + "=" + tuple.value;
- switch (tuple.scope) {
- case this.vscope.page:
- break;
- case this.vscope.session:
- _cookie.setCookie(tuple.name, false, tuple.value);
- break;
- case this.vscope.user:
- _cookie.setCookie(tuple.name, true, tuple.value);
- break
- }
- params = "&" + val
- }
- return params
- }
- };
- var _cookie = {
- sck: [],
- sco: {},
- init: function () {
- var value = this.get("pgv_info=", true);
- if (value != _n) {
- var arr = value.split("&");
- for (var i = 0; i < arr.length; i++) {
- var arr2 = arr[i].split("=");
- this.set(arr2[0], unescape(arr2[1]))
- }
- }
- },
- get: function (name, isend) {
- var cookies = isend ? _d.cookie : this.get("pgv_info=", true);
- var value = _n;
- var offset, end;
- offset = cookies.indexOf(name);
- if (offset > -1) {
- offset += name.length;
- end = cookies.indexOf(";", offset);
- if (end == -1) {
- end = cookies.length
- }
- if (!isend) {
- var end2 = cookies.indexOf("&", offset);
- if (end2 > -1) {
- end = Math.min(end, end2)
- }
- }
- value = unescape(cookies.substring(offset, end))
- }
- return value
- },
- set: function (key, value) {
- this.sco[key] = value;
- var isExist = false;
- var sckLen = this.sck.length;
- for (var i = 0; i < sckLen; i++) {
- if (key == this.sck[i]) {
- isExist = true;
- break
- }
- }
- if (!isExist) {
- this.sck.push(key)
- }
- },
- setCookie: function (name, isend) {
- var id = _cookie.get(name + "=", isend);
- if (id == _n) {
- isend ? id = "" : id = "s";
- var curDate = new Date();
- var curMs = curDate.getUTCMilliseconds();
- id += (Math.round(Math.abs(Math.random() - 1) * 2147483647) * curMs) % 10000000000
- }
- if (isend) {
- this.saveCookie(name + "=" + id, "expires=Sun, 18 Jan 2038 00:00:00 GMT;")
- } else {
- this.set(name, id)
- }
- return id
- },
- save: function () {
- if (_params.sessionSpan) {
- var expires = new Date();
- expires.setTime(expires.getTime() + (_params.sessionSpan * 60 * 1000))
- }
- var cookies = "";
- var sckLen = this.sck.length;
- for (var i = 0; i < sckLen; i++) {
- cookies += this.sck[i] + "=" + this.sco[this.sck[i]] + "&"
- }
- cookies = "pgv_info=" + cookies.substr(0, cookies.length - 1);
- var expire = "";
- if (expires) {
- expire = "expires=" + expires.toGMTString()
- }
- this.saveCookie(cookies, expire)
- },
- saveCookie: function (cookie, expires) {
- _d.cookie = cookie + ";path=/;domain=" + _domainToSet + ";" + expires
- }
- };
- window.pgvMain = function (params) {
- try {
- new tcss(params).run()
- } catch (e) {}
- };
- window.pgvSendClick = function (params) {
- new tcss(params).sendClick()
- };
- window.pgvWatchClick = function (params) {
- new tcss(params).watchClick(params)
- }
- })();
复制代码 就像路上的广告牌一样,你可以选择不看它们,同时不影响你正常走路。
那么互联网上的广告/统计等内容也是一样,只要你愿意,就是可以屏蔽,而同时不影响正常使用的。
何况我们可以
还是老样子,这里给希望说不的人提供一个阻止腾讯统计的方法:
阻止的话,也许论坛后台的统计功能造成影响,这些统计数据对theone管理员对卡饭的决策可能有十分重要的作用
在adblock plus及其它兼容adblock语法的浏览器扩展中即可(全程阻止)
如果是xx卫士、杀毒软件的url过滤、其它第三方广告过滤软件
把以下条目加入黑名单- http://tcss.qq.com/ping.js
复制代码 如果担心到兼容性,可用- ||tcss.qq.com/ping.js$third-party
复制代码 仅在第三方访问时禁止读取该js,仅适用于兼容adblock语法的产品
如果仅希望在卡饭禁止读取该脚本- ||tcss.qq.com/ping.js$domain=kafan.cn
复制代码 同样仅适用于兼容adblock语法的产品
或者可以使用noscript
把tcss.qq.com设为禁止或不可信任 |