Last active
February 28, 2020 16:48
-
-
Save raphaunix/4318212b9c74019e1276ffbed5da26c8 to your computer and use it in GitHub Desktop.
Parsing log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checking the number of login attempts coming from an ip: | |
debian/ubuntu: | |
cat /var/log/auth.log | grep -o '[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}' | cut -d " " -f 1 | sort | uniq -c | sort -unr | |
rhel/centos: | |
cat /var/log/secure | grep -o '[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}\.[0-9]\{0,3\}' | cut -d " " -f 1 | sort | uniq -c | sort -unr | |
Dropping ip attacker with iptables: | |
iptables -I INPUT -s IPATTACKER -j DROP && service iptables restart && clear; iptables -L |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment