From: Vsevolod Stakhov Date: Fri, 18 Feb 2011 14:33:21 +0000 (+0300) Subject: * Add descriptions for all symbols in default configuration, adjust symbols' weights [1] X-Git-Tag: 0.3.7~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f0eafb45ef94088c91ec552d8dbd7c30e37c1bb1;p=rspamd.git * Add descriptions for all symbols in default configuration, adjust symbols' weights [1] * Improve rspamc output by adding '--verbose' flag Suggested by: Victor Ustugov [1] --- diff --git a/rspamd.xml.sample b/rspamd.xml.sample index 875cb6b93..44d6a6566 100644 --- a/rspamd.xml.sample +++ b/rspamd.xml.sample @@ -26,7 +26,7 @@ - + default 10.0 @@ -38,153 +38,158 @@ - MISSING_SUBJECT + MISSING_SUBJECT - FORGED_OUTLOOK_TAGS + FORGED_OUTLOOK_TAGS - FORGED_SENDER + FORGED_SENDER - SUSPICIOUS_RECIPS - - FAKE_REPLY_C + SUSPICIOUS_RECIPS + + FAKE_REPLY_C - MIME_HTML_ONLY + MIME_HTML_ONLY - FORGED_MSGID_YAHOO + FORGED_MSGID_YAHOO - FORGED_MUA_THEBAT_BOUN + FORGED_MUA_THEBAT_BOUN - R_MISSING_CHARSET + R_MISSING_CHARSET - RCVD_DOUBLE_IP_SPAM + RCVD_DOUBLE_IP_SPAM - FORGED_OUTLOOK_HTML + FORGED_OUTLOOK_HTML - R_UNDISC_RCPT + R_UNDISC_RCPT - R_WHITE_ON_WHITE + R_WHITE_ON_WHITE - HTML_SHORT_LINK_IMG_2 + HTML_SHORT_LINK_IMG_2 - FORGED_MUA_OUTLOOK + FORGED_MUA_OUTLOOK - FM_FAKE_HELO_VERIZON + FM_FAKE_HELO_VERIZON - REPTO_QUOTE_YAHOO + REPTO_QUOTE_YAHOO - MISSING_MIMEOLE + MISSING_MIMEOLE - MISSING_TO + MISSING_TO - FROM_EXCESS_BASE64 + FROM_EXCESS_BASE64 - R_MIXED_CHARSET + R_MIXED_CHARSET - SORTED_RECIPS + SORTED_RECIPS - R_RCVD_SPAMBOTS + R_RCVD_SPAMBOTS - R_TO_SEEMS_AUTO + R_TO_SEEMS_AUTO - SUBJECT_NEEDS_ENCODING + SUBJECT_NEEDS_ENCODING - TRACKER_ID + TRACKER_ID - R_NO_SPACE_IN_FROM + R_NO_SPACE_IN_FROM - R_SAJDING + R_SAJDING - R_BAD_CTE_7BIT + R_BAD_CTE_7BIT - R_FLASH_REDIR_IMGSHACK + R_FLASH_REDIR_IMGSHACK - INVALID_MSGID + INVALID_MSGID - MISSING_MID + MISSING_MID - FORGED_RECIPIENTS + FORGED_RECIPIENTS - RATWARE_MS_HASH + RATWARE_MS_HASH - STOX_REPLY_TYPE + STOX_REPLY_TYPE - R_IP_PBL + R_IP_PBL - ONCE_RECEIVED + ONCE_RECEIVED - ONCE_RECEIVED_STRICT + ONCE_RECEIVED_STRICT - RECEIVED_RBL + RECEIVED_RBL - R_PARTS_DIFFER + R_PARTS_DIFFER - MIME_HEADER_CTYPE_ONLY + MIME_HEADER_CTYPE_ONLY - R_EMPTY_IMAGE + R_EMPTY_IMAGE - DRUGS_MANYKINDS + DRUGS_MANYKINDS - DRUGS_ANXIETY - DRUGS_MUSCLE - DRUGS_ANXIETY_EREC - DRUGS_DIET - DRUGS_ERECTILE + DRUGS_ANXIETY + DRUGS_MUSCLE + DRUGS_ANXIETY_EREC + DRUGS_DIET + DRUGS_ERECTILE - ADVANCE_FEE_2 - ADVANCE_FEE_3 + ADVANCE_FEE_2 + ADVANCE_FEE_3 - R_LOTTO + R_LOTTO - BAYES_SPAM - BAYES_HAM + BAYES_SPAM + BAYES_HAM - R_FUZZY - R_FUZZY1 - R_FUZZY2 - R_FUZZY3 + R_FUZZY + R_FUZZY1 + R_FUZZY2 + R_FUZZY3 - R_SPF_FAIL - R_SPF_SOFTFAIL - R_SPF_ALLOW + R_SPF_FAIL + R_SPF_SOFTFAIL + R_SPF_ALLOW - WHITELIST_IP + WHITELIST_IP - MAILLIST + MAILLIST - PH_SURBL_MULTI + PH_SURBL_MULTI - OB_SURBL_MULTI + OB_SURBL_MULTI - AB_SURBL_MULTI + AB_SURBL_MULTI - SC_SURBL_MULTI + SC_SURBL_MULTI - JP_SURBL_MULTI + JP_SURBL_MULTI - WS_SURBL_MULTI + WS_SURBL_MULTI - RAMBLER_URIBL + RAMBLER_URIBL - RAMBLER_EMAILBL + RAMBLER_EMAILBL - PHISHING + PHISHING + + + FORGED_RECIPIENTS_MAILLIST + - + +FORGED_RECIPIENTS & MAILLIST @@ -310,7 +315,7 @@ - + diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 52c29a395..ab6ba5ad7 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -38,6 +38,7 @@ static gint weight = 1; static gint flag; static gboolean pass_all; static gboolean tty = FALSE; +static gboolean verbose = FALSE; static GOptionEntry entries[] = { @@ -47,6 +48,7 @@ static GOptionEntry entries[] = { "weight", 'w', 0, G_OPTION_ARG_INT, &weight, "Weight for fuzzy operations", NULL }, { "flag", 'f', 0, G_OPTION_ARG_INT, &flag, "Flag for fuzzy operations", NULL }, { "pass", 'p', 0, G_OPTION_ARG_NONE, &pass_all, "Pass all filters", NULL }, + { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "More verbose output", NULL }, { "ip", 'i', 0, G_OPTION_ARG_STRING, &ip, "Emulate that message was received from specified ip address", NULL }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; @@ -159,16 +161,16 @@ show_metric_result (gpointer key, gpointer value, gpointer ud) gboolean first; if (metric->is_skipped) { - PRINT_FUNC ("%s: Skipped\n", key); + PRINT_FUNC ("\n%s: Skipped\n", key); } else { if (tty) { - PRINT_FUNC ("\033[1m%s:\033[0m %s [ %.2f / %.2f ]\n", key, + PRINT_FUNC ("\n\033[1m%s:\033[0m %s [ %.2f / %.2f ]\n", key, metric->score > metric->required_score ? "True" : "False", metric->score, metric->required_score); } else { - PRINT_FUNC ("%s: %s [ %.2f / %.2f ]\n", key, + PRINT_FUNC ("\n%s: %s [ %.2f / %.2f ]\n", key, metric->score > metric->required_score ? "True" : "False", metric->score, metric->required_score); } @@ -182,36 +184,62 @@ show_metric_result (gpointer key, gpointer value, gpointer ud) if (metric->action) { PRINT_FUNC ("Action: %s\n", metric->action); } - PRINT_FUNC ("Symbols: "); + else { + PRINT_FUNC ("Symbols: "); + } } if (metric->symbols) { first = TRUE; g_hash_table_iter_init (&it, metric->symbols); while (g_hash_table_iter_next (&it, &k, &v)) { s = v; - if (! first) { - PRINT_FUNC (", "); + if (verbose) { + if (tty) { + PRINT_FUNC ("\n\033[1mSymbol\033[0m - %s(%.2f)", s->name, s->weight); + } + else { + PRINT_FUNC ("\nSymbol - %s(%.2f)", s->name, s->weight); + } + if (s->options) { + PRINT_FUNC (": "); + cur = g_list_first (s->options); + while (cur) { + if (cur->next) { + PRINT_FUNC ("%s,", cur->data); + } + else { + PRINT_FUNC ("%s", cur->data); + } + cur = g_list_next (cur); + } + } + if (s->description) { + PRINT_FUNC (" - \"%s\"", s->description); + } } else { - first = FALSE; - } - PRINT_FUNC ("%s(%.2f)", s->name, s->weight); - - if (s->options) { - PRINT_FUNC ("("); - cur = g_list_first (s->options); - while (cur) { - if (cur->next) { - PRINT_FUNC ("%s,", cur->data); - } - else { - PRINT_FUNC ("%s)", cur->data); + if (! first) { + PRINT_FUNC (", "); + } + else { + first = FALSE; + } + PRINT_FUNC ("%s(%.2f)", s->name, s->weight); + + if (s->options) { + PRINT_FUNC ("("); + cur = g_list_first (s->options); + while (cur) { + if (cur->next) { + PRINT_FUNC ("%s,", cur->data); + } + else { + PRINT_FUNC ("%s)", cur->data); + } + cur = g_list_next (cur); } - cur = g_list_next (cur); } - } - if (s->description) { - PRINT_FUNC (" - \"%s\"", s->description); + } } } @@ -230,7 +258,7 @@ print_rspamd_result (struct rspamd_result *res) if (tty) { printf ("\033[1m"); } - PRINT_FUNC ("Results for host: %s\n\n", connect_str); + PRINT_FUNC ("Results for host: %s\n", connect_str); if (tty) { printf ("\033[0m"); }