Created
August 22, 2017 15:57
-
-
Save dptole/0eb564387983ffc35c575a888f8df769 to your computer and use it in GitHub Desktop.
List all the failed login attempts into your server
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
#!/bin/bash | |
# I'm using "Aug 22" as a date example, you MUST replace this information. | |
cat /var/log/secure | | |
grep '^Aug 22' | | |
grep 'Failed' | | |
sed -r 's/^.*? ([0-9]{1,3}(\.[0-9]{1,3}){3}).*/https:\/\/db-ip.com\/\1/' | | |
sort | | |
uniq | |
# Output | |
#~ https://db-ip.com/116.31.116.5 | |
#~ https://db-ip.com/191.209.113.169 | |
#~ https://db-ip.com/200.216.31.68 | |
#~ https://db-ip.com/218.65.30.53 | |
#~ https://db-ip.com/31.185.104.21 | |
#~ https://db-ip.com/37.97.22.23 | |
#~ https://db-ip.com/46.246.42.82 | |
#~ https://db-ip.com/78.192.107.9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment