Skip to content

Instantly share code, notes, and snippets.

@cnglish
Created June 30, 2019 14:21
Show Gist options
  • Save cnglish/37d40edb29d86427fc5dcf9428aa3f01 to your computer and use it in GitHub Desktop.
Save cnglish/37d40edb29d86427fc5dcf9428aa3f01 to your computer and use it in GitHub Desktop.
#!/bin/bash
# all ip of ssh fail login attempts
lastb | awk '{ print $3 }' | more
# today, sort, count number
lastb -i | grep "$(date '+%a %b %d')" | awk '{ print $3 }' | sort | uniq
# yesterday, sort, count number
lastb -i | grep "$(date '+%a %b %d' --date="1 day ago")" | awk '{ print $3 }' | sort | uniq
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment