Created
March 29, 2016 11:53
-
-
Save wrzlbrmft/589dfa49942f7bd8bec9 to your computer and use it in GitHub Desktop.
List IPs/encounters or hostnames of invalid/accepted logins to sshd.
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
### invalid logins | |
# journalctl (last 7 days) | |
journalctl --since -7d | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq -c | |
journalctl --since -7d | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq | xargs -n1 dig +short -x | |
# /var/log/auth.log | |
cat /var/log/auth.log | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq -c | |
cat /var/log/auth.log | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq | xargs -n1 dig +short -x | |
### accepted logins | |
# journalctl (last 7 days) | |
journalctl --since -7d | grep 'sshd.*Accepted' | awk '{ print $11 }' | sort | uniq -c | |
journalctl --since -7d | grep 'sshd.*Accepted' | awk '{ print $11 }' | sort | uniq | xargs -n1 dig +short -x | |
# /var/log/auth.log | |
cat /var/log/auth.log | grep 'sshd.*Accepted' | awk '{ print $11 }' | sort | uniq -c | |
cat /var/log/auth.log | grep 'sshd.*Accepted' | awk '{ print $11 }' | sort | uniq | xargs -n1 dig +short -x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment