Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Daily script

2025-02-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1) combine the / var/log/secure file to seal off the IP with ssh login failures greater than N

N=3SEC_FILE=/var/log/securefor ip in `grep "Failed password" $SEC_FILE | grep-Eo "([0-9] {1 INPUT 3}\.) {3} [0-9] {1 if 3}" | sort-n | uniq-c | awk'{if ($1 > $N) print $2} '`doiptables-An INPUT-s $ip-p tcp-- dport 22-j DROPdone

2) check the number of connections in each state of the TCP process

Netstat-n | awk'/ ^ tcp/ {+ + S [$NF]} END {for (an in S) print print S [a]}'| | netstat-n | awk'/ ^ tcp/ {print $NF}'| sort | uniq-c example: [root@huangzp ~] # netstat-n | awk'/ ^ tcp/ {print $NF}'| sort | uniq-c 3 ESTABLISHED

3) View and count the number of IP connections

Netstat-ntu | awk'{print $5}'| grep'[0-9]'| cut-d:-F1 | sort | uniq-c example: [root@huangzp ~] # netstat-ntu | awk'{print $5}'| grep'[0-9]'| cut-d:-F1 | sort | uniq-c 1 140.205.140.205 1 183.14.171.25 1 183.14.171.44

4) Statistics of png file size

Find /-name *. Png-exec wc-c {}\; | awk'{print $1}'| awk'{sum=sum+$1} END {print sum} 'example: [root@huangzp ~] # find /-name *. Png-exec wc-c {}\; | awk' {print $1}'| awk'{sum=sum+$1} END {print sum} '22473132

5) Recursive catalog creation

Mkdir-p {0.10} / {0.10}

6) commands that remove # and blank lines from linux text

Cat / usr/local/apache2/conf/httpd.conf | grep-Ev'(^ # | ^ $)'

7) use tcpdump to sniff the access to port 80 to see who is the highest

Tcpdump-I eth0-tnn dst port 80-c 10 | awk-F "."'{print $1 "." $2 "." $3 "." $4}'| sort | uniq-c

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report