Skip to content

Instantly share code, notes, and snippets.

@dam2k
Last active April 4, 2022 22:29
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 dam2k/a0cca4b50916b266e0173c7e76f9f0bc to your computer and use it in GitHub Desktop.
Save dam2k/a0cca4b50916b266e0173c7e76f9f0bc to your computer and use it in GitHub Desktop.
Parse all identified incoming spam emails from mailcleaner's log /var/mailcleaner/log/mailscanner/infolog and show them clearly
#!/bin/bash
echo "SPAMSCORE|MAILID|SRCIP|SRCMAIL|DSTDOMAIN" 1>&2
grep -P '(?=.*?spam decisive\))(?=.*?Spamc \()' /var/mailcleaner/log/mailscanner/infolog | sed -E -e 's/^[A-Za-z]*.* Message ([-a-zA-Z0-9]*) from ([.:a-zA-Z0-9]*) \(([-_+=.a-zA-Z0-9]*@[-_+=.a-zA-Z0-9]*\.[-_=.a-zA-Z]*)\) to ([-_a-zA-Z]*\.[-_a-zA-Z.]*) .*, Spamc \(score=([0-9.]*), .*$/\5|\1|\2|\3|\4/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment