Linux下查找CC攻击的方法

什么是CC攻击?CC攻击就是利用大量代理服务器对目标计算机发起大量连接,导致目标服务器资源枯竭造成拒绝服务。那么如何判断查询CC攻击呢?本文主要介绍了一些Linux下判断CC攻击的命令。

查看所有80端口的连接数

netstat -nat|grep -i “80″|wc -l

对连接的IP按连接数量进行排序

netstat -anp | grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

netstat -ntu | awk ‘{print $5}’ | egrep -o “[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}” | sort | uniq -c | sort -nr

查看TCP连接状态

netstat -nat |awk ‘{print $6}’|sort|uniq -c|sort -rn

netstat -n | awk ‘/^tcp/ {print $NF}’|sort|uniq -c|sort -rn

netstat -n | awk ‘/^tcp/ {++S[$NF]};END {for(a in S) print a, S[a]}’

netstat -n | awk ‘/^tcp/ {++state[$NF]}; END {for(key in state) print key,”\t”,state[key]}’

netstat -n | awk ‘/^tcp/ {++arr[$NF]};END {for(k in arr) print k,”\t”,arr[k]}’

netstat -ant | awk ‘{print $NF}’ | grep -v ‘[a-z]‘ | sort | uniq -c

查看80端口连接数最多的20个IP

cat /www/web_logs/waitalone.cn_access.log|awk ‘{print $1}’|sort|uniq -c|sort -nr|head -100

tail -n 10000 /www/web_logs/waitalone.cn_access.log|awk ‘{print $1}’|sort|uniq -c|sort -nr|head -100

cat /www/web_logs/waitalone.cn_access.log|awk ‘{print $1}’|sort|uniq -c|sort -nr|head -100

netstat -anlp|grep 80|grep tcp|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -nr|head -n20

netstat -ant |awk ‘/:80/{split($5,ip,”:”);++A[ip[1]]}END{for(i in A) print A,i}’ |sort -rn|head -n20

用tcpdump嗅探80端口的访问看看谁最高

tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F”.” ‘{print $1″.”$2″.”$3″.”$4}’ | sort | uniq -c | sort -nr |head -20

查找较多time_wait连接

netstat -n|grep TIME_WAIT|awk ‘{print $5}’|sort|uniq -c|sort -rn|head -n20

查找较多的SYN连接

netstat -an | grep SYN | awk ‘{print $5}’ | awk -F: ‘{print $1}’ | sort | uniq -c | sort -nr | more

linux下实用iptables封ip段的一些常见命令:

封单个IP的命令是:

iptables -I INPUT -s 211.1.0.0 -j DROP

封IP段的命令是:

iptables -I INPUT -s 211.1.0.0/16 -j DROP

iptables -I INPUT -s 211.2.0.0/16 -j DROP

iptables -I INPUT -s 211.3.0.0/16 -j DROP

封整个段的命令是:

iptables -I INPUT -s 211.0.0.0/8 -j DROP

封几个段的命令是:

iptables -I INPUT -s 61.37.80.0/24 -j DROP

iptables -I INPUT -s 61.37.81.0/24 -j DROP

想在服务器启动自运行的话有三个方法:

1、把它加到/etc/rc.local中

2、iptables-save >/etc/sysconfig/iptables可以把你当前的iptables规则放到/etc/sysconfig/iptables中,系统启动iptables时自动执行。

3、service iptables save 也可以把你当前的iptables规则放/etc/sysconfig/iptables中,系统启动iptables时自动执行。

后两种更好此,一般iptables服务会在network服务之前启来,更安全。

解封的话:

iptables -D INPUT -s IP地址 -j REJECT

iptables -F 全清掉了

转载自:http://netsecurity.51cto.com/art/201305/393377.htm

6 natural green manner labeling
quick weight loss 4 men’s fashion trends for Winter 2013

How to Trim an Old Fashioned Rose Bush
how to lose weight fastShop Trendy Lingerie Items with Zivame Coupons
The Best Foods for Breast Cancer
casas bahia who did not even bother to use the word Spaarti

Our replica Concord watches are almost indistinguishable from the real thing
click jogos The second eldest school is that of St

5 Famous Modern Events You Won’t Believe Happened Before
gay porn no matter how catchy it is

Exploring Career Opportunities for Part time Ph
rape porn While these kind of clothes varies from person to person

How to Pitch an Article to Teen Vogue Magazine
free black porn How Much Do Fashion Magazine Editors Make

Macerich’s CEO Presents at Citi Global Property CEO Conference Transcript
anime porn When you wear your tshirt and it looks like this

Does Amoryn Help Relieve Depression
free gay porn of its sales

Komen for the Cure to stop funding Planned Parenthood centers
quick weight loss she’s the most normal marionette yet
youjizz
此条目发表在 网站架构 分类目录。将固定链接加入收藏夹。

评论功能已关闭。