Shell practice: analyze nginx logs at regular intervals and block webscan users on this site
Source: Internet
Author: User
Shell practice: analyze nginx logs at regular intervals, and block users using webscan on this site from 01 to analyze nginx logs at regular intervals, in addition, we will block 02 nginx logs and find 03 atible; MSIE60; WindowsNT50; NETCLR114322) shell practices: regular analysis of nginx logs, in addition, the website's webscan users will be blocked 01 to regularly analyze nginx logs, and the site's webscan users will be blocked 02 03 atible; MSIE 6.0 found when viewing nginx logs; windows NT 5.0 ;. net clr 1.1.4322) "042108181.55.30--[20/Jul/2013: 19: 55: 57 + 0400]" GET/article/show/14 /? Classid = 2-% 28-9999995% 29-9999995-0-0-0 HTTP/1.1 "200 5285" http://scpman.com:80/article/show/14/?classid=2-%28-9999995%29-9999995-0-0-0 "" Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; WebscanSpider) "052108181.55.29--[20/Jul/2013: 20: 06: 05 + 0400] "GET/web-console/HTTP/1.1" 404 225" http://scpman.com:80/web-console/ "" Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; WebscanSpider) "06: 07 # cat/usr/shell_work/iptab_nginx.sh08 #! /Bin/bash09 # code by scpman10 # ban the webscan users on this site, and there are fewer users .. 11for ip in 'cat/usr/local/nginx/logs/access. log | grep 'webscanspider '| awk' {print $1} '| sort-u'12do13/sbin/iptables-I INPUT-s $ ip-p TCP -- dport 80-j DROP14done15 # add it to the timer, come back once every 10 minutes 16 */10 */usr/shell_work/iptab_nginx.sh17Chain INPUT (policy ACCEPT) 18num target prot opt source destination 191 DROP tcp -- 220.181.55.30 0.0.0.0/0 tcp dpt: 80202 DROP tcp -- 220.181.55.29 0.0.0.0/0 tcp dpt: 8021
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service