Last active
November 20, 2015 07:16
-
-
Save forestbaker/9b3b30f18793f924748a to your computer and use it in GitHub Desktop.
display IP's that unsuccessfully attempted to login 5 or more times,
This file contains hidden or 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
# original - this is all bad logins - ever! | |
lastb -i | grep -Po '\b(?!255)(?:\d{1,3}\.){3}(?!255)\d{1,3}\b' | sort | uniq -c | awk '{ if ($1 >= 5) print $2; }' | |
# early prototype - this works - but returns words | |
lastb -i | awk '{ print $3 }' | sort | uniq -c | awk '{ if ($1 >= 5) print $2; }' | |
# ah ha! this filters out the blank line and date/time stamp that was causing the words to appear | |
lastb -i | egrep -v '^$|btmp' | awk '{ print $3 }' | sort | uniq -c | awk '{ if ($1 >= 5) print $2; }' | |
# same as above, but only IP addresses from today | |
lastb -i | grep "$(date '+%a %b %d')" | awk '{ print $3 }' | sort | uniq -c | awk '{ if ($1 >= 5) print $2; }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment