Skip to content

Instantly share code, notes, and snippets.

@maikgreubel
Created December 14, 2021 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maikgreubel/132d7d49dc429666941d8da0bc22495d to your computer and use it in GitHub Desktop.
Save maikgreubel/132d7d49dc429666941d8da0bc22495d to your computer and use it in GitHub Desktop.
for o in $(grep -A1 "failed mail authentication attempt for user" /var/log/maillog |grep "authentication fail" | perl -pe 's#.*unknown\[([^\]].*?)\].*#\1#' | grep -E "^[[:digit:]]+" | uniq); do whois $o | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}\/" | grep -v "^%" | awk '{print $2}'; done
@maikgreubel
Copy link
Author

one liner to find and list ip addresses in maillog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment