Afficher les scores pour les règles correspondant à un mail
Mais on ne trouve pas les scores associés.
Il est possible d'utiliser ce script spamassassinScore pour obtenir les scores a posteriori :
#!/bin/bash
#
# Get list of spamassassin rules matching and calculate the score
#
# The order of SEARCHPATH is important, use the updates before the default entries
SEARCHPATH="/var/lib/spamassassin/4.000001/updates_spamassassin_org/ /usr/share/spamassassin/"
LIST="$1"
if [ "x$LIST" == "x" ]; then
echo "ERROR : Missing matching rules"
echo "$0 BAYES_00,DMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RAZOR2_CF_RANGE_51_100"
exit
fi
REGEX="^score ($( echo $LIST | sed 's/,/ |/g') )"
# Return only the first definition of the score (which may defined multiple times)
SCORES=$(egrep -rh "$REGEX" $SEARCHPATH | sed "s/ *#.*//" | sort | awk -F"[. ]" '!a[$2]++')
# The score lines may have a comment : remove it
# The score lines may have one or multiple numbers : if one return it,
# if multiple, use the second one
#VALUES=$(sed -r 's/.*[^0-9. ]+([0-9. ]*)$/\1/' <<< "$SCORES")
VALUES=$(awk '{print $3 " " $4 " " $5 " " $6}' <<< "$SCORES" | awk '
{ if ($2 != "") { print $2 } else { print $1 } }')
SCORESNAMES=$(awk '{print $1 " " $2}' <<< "$SCORES")
TOTAL=$( awk '{ sum += $1 } END { print sum }' <<< "$VALUES")
paste <(echo "$SCORESNAMES") <(echo "$VALUES") | column -t | sort -nr -k3
echo "TOTAL=$TOTAL"
Exemple :
spamassassinScore BAYES_00,DMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RAZOR2_CF_RANGE_51_100
score RAZOR2_CF_RANGE_51_100 2.430 score HEADER_FROM_DIFFERENT_DOMAINS 0.007 score HTML_MESSAGE 0.001 score DMARC_MISSING 0.001 score BAYES_00 0 TOTAL=2.439