|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑 ^3 y5 b1 z7 j0 s
$ G" [: G; a% _5 k% v* g
上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
$ W D1 l9 j5 f" w" j
! k% B; x% m) q' M接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}
% A$ F* o/ f( H. Dhttps://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 . p, |7 ~ y( m
7 ~. s( O7 d3 w1 B I顺便查下ip138:
. T: [2 P& Q; x) \% e) o9 B; E# ?) T: L9 z4 D# W% c, T( G3 A U
这是那段js里面的代码,好象是个半成品还没写入广告数据:
0 c8 G, U9 U* T; ]7 t3 e' f- function locationSearch() {( D5 g. V/ w' {; O1 ]: h/ A
- var s = getMainJs();; e0 U# Q7 E: ~7 l
- if (s == null) {
* }! t$ W" H, G A7 h; T0 s; h - location.reload();
: P7 ?" H; N" H) \/ K - }
' [+ V8 W% P8 w - return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);0 E- v" `/ G3 a( v' f& e8 X
- }
7 S5 m. |# P& {. n
( l! i9 `/ g( |5 U- function getParameter(name, paraStr) {
/ e1 Z3 M" G# h7 a - var result = "";4 a, h/ m- ~/ k2 s6 ]
- var str = "&" + paraStr.split("?")[1];
# a) ?/ b9 x. \7 ? - var paraName = "&" + name + "=";2 L3 q+ _, j2 w
- if (str.indexOf(paraName) != -1) {* {' ]# e+ W$ q1 c/ T" Y; Q; e
- if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {
4 ?0 j/ z! K* b- \1 a- X - var TmpStr = str.substring(str.indexOf(paraName), str.length);
/ X, j, r" k0 |# C - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(
4 ^- v3 n+ W$ |+ Q - 1, TmpStr.length).indexOf("&")/ G8 s/ k0 K/ t
- - TmpStr.indexOf(paraName) + 1);5 ?4 w# m- z& b2 T# x
- } else {
% _7 x; v6 y* g: Q* E - result = str.substring(str.indexOf(paraName), str.length);
# v( y$ Q: {: D& w+ C - }5 G9 [8 b1 \% l+ |9 L; [7 c
- 4 m- a8 c& X1 k0 A% W6 V( r# s8 P
- result = result.substring(result.indexOf("=") + 1, result.length);$ J- z6 t# @2 Q5 I+ B
- } else {3 B8 Z( s. G' s& B4 t
- result = "No such parameter";
5 K4 X1 U, [$ Q* A9 F F* o( g: I( R - }. b9 Z; U& j/ j+ F5 q& y
- return (result.replace("&", ""));+ g: V$ u7 i* @' e* i8 [! ~1 _
- }5 j- |" }; r: B. v8 [
- ; b7 s3 l! ~/ F; E5 r& `
- function getMainJs() {
$ n) } l; |8 _7 Y9 K8 x6 l - var scripts = document.getElementsByTagName("script");4 x# d7 R1 i8 W
- var s = null;
2 c* {! M# v) l - for (var i = 0; i < scripts.length; i++) {
5 c9 K- N# s2 Y/ j6 @ - if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
, V# u; ^* W+ M y3 d: t - s = scripts[i];' q( W; Q) S |. I$ M7 m, B" w
- break;# ?* s5 t6 }. j1 t! V* Z
- }) Q, o$ q/ C. v' q( j
- }
b7 t9 @) M3 R( P) Z$ n - return s;5 x" m* y$ Q8 V1 E/ V
- }
% w1 z# {/ x( p) j$ X3 i- c5 u- Y - & K5 c& U* e- b8 g' s
- function appendParam(oStr, aStr) {
4 u$ u3 J, ^, R+ z, ^3 Y2 N - if (oStr.indexOf('?') > 0) {
6 X8 s7 F' B. w, i3 } - oStr = oStr + "&" + aStr;
* ]. f6 ?/ R9 S( u/ c, |: y0 } - } else {
! A; N+ O0 |+ n: W - oStr = oStr + "?" + aStr;
: l, Z# B4 }. |2 {' n2 B0 z, b - }
a7 v6 u. ~$ w. K2 H% K) K/ ] - return oStr;; q/ @% W* Y5 M$ \ d6 |
- }
% ~, K% l+ p* f m" _0 ^* ~! A9 M
; X7 x" Y2 s9 }* V( h0 r- window.onerror = function() {
: W; n& N" x/ A: Z - };+ m$ r2 f+ v1 _
- + T6 `9 a% e0 [' I
- var g_titleTime = 0;
! T) T# t- p% d - function setTcTitle() {) b, {- o8 B( J1 K7 a
- if (undefined == document) {, P5 [6 J$ X8 Q! ]+ W* R3 X) E
- g_titleTime++;
, h! H! c! ~+ A% Q) W) y& S; b. r/ s7 l - setTimeout("setTcTitle();", 1000);
# u/ F1 D; b9 c& q, f) c - return;2 g$ w4 O$ X2 q& I1 ]: `
- }
1 _# J* c7 T$ ]$ N* }
2 O* T$ Y2 S2 Y0 S! R- var doc;# v: O( f+ A) {( l
- try {4 ^4 |. C0 F% M2 ?
- if (document.all) {* v% ^6 h# E& u
- doc = document.frames["cn"].document;# x) R6 B2 L* `/ m
- } else {6 r" k. J+ `1 o6 t+ U! L. h8 x
- doc = document.getElementById("cn").contentDocument;
+ a! `& a; R# ?" ]% [ - }" {4 b m: l; O+ Z' b0 L" ^; e5 C
- } catch (ex) {1 g# e, k R) i: e* M( D4 n* X* B
- }: U9 P+ p0 V1 `' X: L
- 6 y9 A5 k5 G: V& c, f
- if (g_titleTime < 5
! L5 _( b6 N% e) O - && (undefined == doc || undefined == doc.title || "" == doc.title)) {
" {! J3 P; K: Z7 G( E - g_titleTime++;
3 {: b; T$ R D, P - setTimeout("setTcTitle();", 1000);
+ p6 p9 ], L: D( |6 ^ - return;9 T$ v8 ?! I, L P8 ^
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
% i, `0 J3 ]. G0 U, d - document.title = doc.title;7 a- ~0 l0 C9 F% k) v
- setTcAdvVisible();
7 Q3 L( q( E7 N$ m6 A6 F: |$ [. x& L - }
/ y) H/ x2 F S) e; L4 D - }
" h; |% K$ Z- X5 n% C, |0 x4 P
7 F/ x2 D1 a5 e- G' H- D( k- setTimeout("setTcTitle();", 1000);
3 |4 g% J3 D" c; S+ n/ c9 B( s
. M, G& c9 \4 s6 s5 G$ T' V- var g_isHaveVisible = false;' V, @% `' P Y' w9 Q
- function setTcAdvVisible() {
4 W3 K. A3 P8 j: l - if (undefined != document && undefined != document.getElementById("addiv")
# [; m! ^- Q e: O& ^3 U! }( s0 Z - && !g_isHaveVisible) {
8 X; `8 Z" n9 ]$ x3 u! U - document.getElementById("addiv").style.visibility = 'visible';5 ?: K! t6 `$ q" W5 B! N9 c
- document.getElementById("addiv").style.display = 'block';4 s: P. @0 |2 ?% H/ N' a' A
- g_isHaveVisible = true;! L) ~. ^4 w! o
- }/ W/ H$ O" U* K# T/ P
- }
- ~ L* T* e8 z" A( G6 l - 3 T2 J& f' t9 \& c+ Q! Y) h
- function UrlAnalyzer() {
" u# @9 w2 O; Z5 O - this.divda = "";. E, }9 U/ O$ |& q0 f0 D
- this.tctype = "";
0 X. R8 s1 V) M% B - this.radius = "";) g+ }, Y6 V, a* W; m! v
- this.rlu = "";( g0 C1 `* T% M% g/ n4 a
- }# I5 K) i# G/ W/ D
0 w! @2 `! d9 j9 b- UrlAnalyzer.prototype.initParameters = function() {
, j+ Y: ?2 L8 S - var paraStr = locationSearch();
S0 q n" Q9 h& q - this.rlu = getParameter("lruedct", paraStr);
: M; N5 t/ i! T4 G/ r - this.divda = getParameter("divda", paraStr);
( K Q) V3 Z2 D6 D - this.radius = getParameter("radius", paraStr);
4 E, o* n( _9 n0 F$ C& y - this.tctype = getParameter("tctype", paraStr);
( h. Q6 c2 |% O9 ^5 ^ - this.address = getParameter("address", paraStr);1 V: ?, c% Y9 b. E2 @
- this.usagent = getParameter("usagent", paraStr);" k3 j( {/ ^/ @8 u
- }$ @- |- g& l- t0 f- `' E& h4 l; N8 s
- ! `. r, t- Z+ Z) `- |
- UrlAnalyzer.prototype.getHtmlDoc = function() {
2 { h" A# r `% Q4 [! C, d - var doc;- L& f8 J# J. q$ J& w
- try {' e, V) r. m/ H7 K& S5 l( S
- if (document.all) {0 p4 X3 y" E) X0 J# d
- doc = document.frames["cn"].document;
* m) v9 t" Y5 F) |3 @ - $ j r/ y0 c9 H7 \8 w- _# P
- } else {
& j! C/ @0 `; u; z' f# f% i0 ] - doc = document.getElementById("cn").contentDocument;- y" F6 }- ^+ K% z8 ]' T5 ^& i
- // doc = document.getElementById("cn").contentWindow.document; @) d) S+ K$ X7 r
- }4 e( G3 X+ N) D5 R) r( s
- } catch (ex) {
) q* S: M! h/ T0 S+ P; h - }
0 R `+ ~. A- m4 u/ c - return doc;
4 m N2 [; g' ~0 C - }
" {8 A. o6 Q8 W; q
$ U+ I3 W) y$ b L4 n, p5 C$ w8 G- UrlAnalyzer.prototype.setDomain = function() {3 c% r( f( o% B/ u& A$ k
- if (undefined != document.title && "" == document.title)
5 x# Z/ I; `+ h+ `# g8 c - {8 U" B8 [4 I+ k$ I/ Z
- var index = document.domain.indexOf(".");
7 d+ D2 G+ [ | - if (undefined != index && -1 != index) {
, \. w/ @) ^$ a6 d$ X$ F/ X4 s5 H+ M - document.domain = document.domain.substring(index + 1,
3 Y" Z. A8 Q# W9 z! O - document.domain.length);. ]2 Z1 r) I# r7 R' n
- }
( R4 ?8 H( F* x$ C" a/ r* v2 b -
" K% E3 F* E3 }/ { - var doc = this.getHtmlDoc();
: R5 P, o) u4 y - if (undefined != doc && undefined != doc.title && "" != doc.title) {" O" g; P o0 J
- document.title = doc.title;2 M- D' M) e& d" J: ^% ~' _ M
- setTcAdvVisible();' T7 J5 f9 [2 W V7 ~
- }8 ~2 H0 g# X' S8 S. R2 a
- }
2 E, i& }" V7 m - }
( e$ N# P/ C- ]
" y' V) k6 T0 r4 E8 p# @- UrlAnalyzer.prototype.iframeCallback = function() {3 a8 N) _0 \3 r1 J
- var doc = this.getHtmlDoc();
0 p$ {' { O( \5 t' x K z! ~0 b - if (undefined == doc || undefined == doc.title || "" == doc.title) {
4 ?+ F' q4 B5 [2 Q& x- y( E - if (undefined != document.domain) {2 ]& r8 l$ j; u. K6 b, o* r
% P7 ?: Y: o, A# u( R# L- var self = this;
5 _1 A P, _: L' W( l - setTimeout(function(){self.setDomain.call(self, null)}, 1000);( g- R1 A! l3 q, O
- // var index = document.domain.indexOf(".");, p6 A, k, q* o# E' Q
- // if (undefined != index && -1 != index) {+ u: S" S3 V9 O) {# Q! x4 ?/ u
- // document.domain = document.domain.substring(index + 1,6 b$ g3 E; V! ?7 n: ^
- // document.domain.length);
- X* j' {, E+ X/ [ - // }
: {1 f8 i! W) \+ B: ^- I - //: ]" |8 Z+ A; `: l! l4 J
- // var doc = this.getHtmlDoc();2 g! K$ X8 c% B. |9 }' H5 d. M
- // if (undefined != doc && undefined != doc.title && "" !=% g. G R: S. O9 |
- // doc.title) {
8 I# W' v; E3 s4 x% ? - // document.title = doc.title;: C$ \* |- R2 M
- // setTcAdvVisible();
1 V* I4 p. U1 S _$ b" S - // }
& n' U; I3 b$ A8 o; [, f0 y - }( D4 T( }0 ` I: X1 d, t- _
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
( D# t" g3 ~; P9 Q/ T - document.title = doc.title;
$ D8 m3 m K3 |; r6 O: B& l5 l - setTcAdvVisible();
: v" f+ H9 W+ i: R) c3 E) N - }
8 B3 T- Q* ?2 A# o; }3 l - }' l1 L t2 W5 M; S0 q* Z
- 5 Q: i( u3 n5 X9 C8 L9 H
- UrlAnalyzer.prototype.executeHtmlContext = function() {1 R# R) r9 C) ^+ J H! e
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda
7 i" K# |7 ], v; Z/ J8 O - + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;6 F* b/ ^5 O$ ?. N$ Q% R1 R! k
- : K% e N- T5 D$ N
- var htmlStr = "<iframe src="" + staUrl: F9 G3 y( k+ ?8 i: ~# x1 g
- + "" style="display:none"></iframe>";
# p b& A" {' R- J! a - 2 N0 w- u6 E$ M% J M9 `
- var advUrl = htmlStr
( ~" d8 i/ b: }# E - + "<script src="http://c2.sxite.com:8060/center?advId="
% p3 E+ [" j. n. f - + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";( y& b/ U6 u# g) X
- document.write(advUrl);$ [( _9 m$ \, S9 }
- $ ^, ~5 Y& v& I" F# {; ]
- var self = this;
. t2 y! {6 L0 i8 t; k7 ?% P5 \8 k' J - var iframe = document.getElementById("cn");' {. p+ `& b: m4 w2 i' R
- if (iframe.attachEvent) {+ ?% x5 {3 J, H% e' |0 P
- iframe.attachEvent("onload", function() {$ O# A1 V. k% g3 d' u# m
- self.iframeCallback.call(self, null);+ n: V8 H: _& J% E8 e( |- E
- });
8 m& d, E, P6 t7 ^5 Y% m - } else {
2 Z; d( b7 J7 S6 }3 ^ - iframe.onload = function() {5 B2 H% s# r6 ?, O, A' `: F! [* X o& S
- self.iframeCallback.call(self, null);9 Q0 u- X; y/ S7 W1 ~6 H& @/ O
- }6 A+ P# D0 g% Y
- }" d! d' C, W' _, e& l1 P" }+ y: {& o! ~
- }
5 n' T, ]8 I. B( I( w1 ^ - ! h* t7 G/ W; [. ?2 @
- UrlAnalyzer.prototype.executeMain = function() {
! L h1 K+ a& | i$ _! V& F - var mainFrame = document.getElementById("cn"); N$ {" e$ ]+ E
- mainFrame.contentWindow.location.href = mainFrame.src;4 R% E8 i% v: s: ]. u
- this.initParameters();
% J, B3 A! e$ T8 g1 m - this.executeHtmlContext();
4 `: V0 P; {1 d3 @' N$ c: }% f& P; f: Y - }4 Y h& i; D5 k) j( |& J/ I- B
/ G3 b& ]" V7 d) G3 Q/ O- var g_analyzer = new UrlAnalyzer();
9 N0 u4 y5 A, @ K$ u - g_analyzer.executeMain();9 _! o$ M6 S, T0 M, U, m6 `
复制代码 $ I! u1 ]. i( @3 Q
$ ~4 \/ G% Z) q" p
& Z4 J$ \, B9 t1 F K3 Z |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|