cookie的污染!

来源:互联网 发布:js时间戳转换成天数 编辑:程序博客网 时间:2024/04/30 16:36

下图是我用wireshark的抓包,有个关于cookie的问题我比较郁闷:

GET /user.php?act=login HTTP/1.1\r\n后回返的HTTP/1.1 200 OK\r\n设置了cookie如下:
ECS_ID=0a22939846734023b5b1dfd98de4d0f28230d386; path=/
ECS[visit_times]=1; expires=Sun, 07-Oct-2012 17:39:28 GMT; path=/
之后GET /captcha.php?is_login=1&2132503621 HTTP/1.1\r\n的cookie却是:
Cookie: ECS_ID=0a22939846734023b5b1dfd98de4d0f28230d386; ECS[visit_times]=1; cnzz_a2408473=0; sin2408473=; rtime=0; ltime=1318124382171; cnzz_eid=55038762-1318120773-; __utma=17458850.2041195220.1318124382.1318124382.1318124382.1; __utmb=17458850.1.10.1318124382; __utmc=17458850; __utmz=17458850.1318124382.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

之后搜索到一篇文章才知道乍回事,见下文章:

由于第一次研究cookie,在分析校内的cookie的时候,遇到了一些__utma utmz的Name,参数的内容完全分析不懂,经多方求教,终于知道了原来那些代码竟然是Google的免费网站统计系统产生的信息(垃圾代码害得我浪费了整整一天),Down下来了它的生成文件:Urchin.js 几千行代码看的我脑袋发木,最后百度搜索寻求不到结果,求助于Google,才得到了如下的信息:

This article/section is a stub . 
It is here because it was planned, created to drop some preliminary notes. Statements may be wrong, and the style and structure may suck. Feel free to add further notes or suggestions, rewrite sections or the whole into something understandable.

The cookies named:

  • __utmv is used for user-custom variables in Analytics
__utma__utmz

...and others are part of Google Analytics , specifically the Urchin tracking module. These cookies track usage on sites that use Google Analytics.


Some details:

  • __utmz tracks where a visitor came from (search engine, search keyword, link)
  • __utma tracks each user's amount of visits, first, last visit.
  • __utmb and __utmc are used to track when a visit starts and ends to some decent time resolution (c expires quickly). If you look at cookie state changes (e.g. using firecookie ), you will see these change a lot .

如上,英文的内容实在让人看得头痛,下面简要翻译下各个参数的内容:

__utmz:跟踪访问者是从哪里来的(搜索引擎,搜索关键字,链接地址);

__utma:跟踪每个用户的大量访问,第一次,最后一次;

__utmb和__utmc是跟踪每个用户的访问时间,从开始到结束。

好了,现在了解了这些无关紧要的数据了,算法还未分析完毕,先把代码贴上,希望牛人如果看到的话给一下具体算法,到底如何计算出这几个参数的~

原创粉丝点击