DDoS渗透与攻防实战(二):CC攻击工具实现与防御理论

我们将要实现一个进行应用层DDoS攻击的工具,综合考虑,CC攻击方式是最佳选择,并用bash shell脚本来快速实现并验证这一工具,并在最后,讨论如何防御来自应用层的DDoS攻击。

第一步:获取大量可用代理ip:port列表

网上所处可见免费代理,我们使用http的GET方法抓取html文档,接着使用正则过滤出我们需要的ip port对,然后逐一验证各代理的可用性,最终得到可用的代理ip port对。

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  " http://www.youdaili.cn/Daili/guonei/2215.html " \
            " http://www.youdaili.cn/Daili/guonei/2215_2.html" \
            " http://www.youdaili.cn/Daili/guonei/2215_3.html" \
            " http://www.youdaili.cn/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 1>&2
        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对所存放的文件路径

check_proxy.sh
#!/bin/bash

#get proxy list
declare check_threads=
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值