1 |
--- smeserver-mailstats-0.0.3/root/usr/bin/spamfilter-stats-7.pl.removeChangelogFromScript 2008-10-04 10:43:48.000000000 +0200 |
2 |
+++ smeserver-mailstats-0.0.3/root/usr/bin/spamfilter-stats-7.pl 2008-10-04 10:41:18.000000000 +0200 |
3 |
@@ -6,97 +6,9 @@ |
4 |
# junkmails. Configuration of the script is done by the Spam Filter |
5 |
# Server-Manager module |
6 |
# |
7 |
-# April 2006 - no longer controlled by server manager, and does not delete files |
8 |
-# |
9 |
-# This script has been developed |
10 |
+# This script has originally been developed |
11 |
# by Jesper Knudsen at http://sme.swerts-knudsen.dk |
12 |
# |
13 |
-# Revision History: |
14 |
-# |
15 |
-# August 13, 2003: Initial version |
16 |
-# August 25, 2004: fixed problem when hostname had no-ASCII chars |
17 |
-# March 23, 2006 Revised for sme7 RM |
18 |
-# March 27, 2006 ditto BJR (http://www.abandonmicrosoft.co.uk) |
19 |
-# - Merged Clamav and SA stats |
20 |
-# - Moved all analysis to qsmtpd log |
21 |
-# - Removed parameterised interval (for simplicity - not sure of format anyway) |
22 |
-# - add in archived log files for people who have high turnover |
23 |
-# - Alter labels to be more accurate |
24 |
-# - Detect deleted spam (over threshold) without using spam score |
25 |
-# - Detect RBL rejections |
26 |
-# - Detect pattern (executible) rejections |
27 |
-# - Look for the DENY labels - add in Miscellaneous category |
28 |
-# April 6, 2006 - check qpsmtp log level and also DNS enable properties |
29 |
-# - Average spam scores for under and over threshold seperatly |
30 |
-# - Log tag and Reject levels |
31 |
-# - TBD - check that RBL DENY are being detected (I have no date to check this) |
32 |
-# April 7, 2007 - re-written by Charlie Brady totally in Perl |
33 |
-# April 16, 2006 - move warnings to report |
34 |
-# - Spot fetchmail deliveries |
35 |
-# - Spot Internal connections from client PCs |
36 |
-# - TBD check that RBL DENY are being detected (I have no data to check this) |
37 |
-# April 30, 2006 - Pascal Schirrmann Start Time and End Time to noon - should be a param |
38 |
-# so the script can be run at any time in the day. |
39 |
-# - adds 'by recipients domains' stats Useful for MX-Backup or multi domains hosts |
40 |
-# - Add a 'recipients per mail' stat. Useful : until now the sums are correct :-) |
41 |
-# - Correct some messages about rbl who can led to wrong entry in the config database |
42 |
-# ( and without expected results, of course !) |
43 |
-# - improve a regexp in the SPAM detection |
44 |
-# May 1, 2006 - BJR - Fix situation where mxbackup prop is not defined |
45 |
-# - fix a spelling and minor format of domain report |
46 |
-# May 9, 2006 - bjr - Make RBL percentage a percentage of total connections (else it >100%) |
47 |
-# May 9, 2006 - ps - some 'sanity check' in the 'per domains part of the stats (to avoid / 0) |
48 |
-# May 12, 2006 - ps - some cleanup in the 'per domains' stats |
49 |
-# - Add a version number, logged in the mail |
50 |
-# June 20, 2006 - bjr - Minor change to RBL instructions, and adjust domain table format |
51 |
-# Feb 19, 2007 - bjr - Adjust table lines oin a couple of places |
52 |
-# - bjr - and add documentation details about percentages etc |
53 |
-# - bjr - Alter misc to "non conforming" anmd accumulated these hourly |
54 |
-# - bjr - Express change over tag count to exclude spam rejected over threshold |
55 |
-# - bjr - Change "processsed" to "fully downloaded" |
56 |
-# - bjr - Change percentages so that they are all a percetnage of the total emails received |
57 |
-# 0.6.1 - bjr - Change to use output from the logterse qpsmtpd plugin |
58 |
-# 0.6.2 - bjr - Fix fetchmail tests |
59 |
-# 0.6.3 - bjr - adjust for log-items change in order |
60 |
-# 0.6.4&5 - bjr - Adjust table formatting |
61 |
-# 0.6.6 - bjr - Take outgoing emails out of "others", add "Outgoing" and "Internal" |
62 |
-# 0.6.7 - bjr - Fix missing plugins/wrong names. pull invalid recipient out of deny msg for goodrcptto |
63 |
-# 0.6.8 - bjr - catch a few more plugin name failures |
64 |
-# 0.6.9 - bjr - Catch webmail and mailman |
65 |
-# 0.6.10 - bjr - Refine Webmail identification |
66 |
-# 0.6.11 - bjr - Fix Webmail identification |
67 |
-# 0.6.12 - bjr - split logterse line a bit more carefully (multiple sent to addresss with space and comma confuse it) |
68 |
-# 0.6.13 - bjr - add totals and percentages to bottom of the table |
69 |
-# - Generalise counts so that columns can be brought in and out |
70 |
-# - control columns with Db entries |
71 |
-# 0.6.14 - bjr - Add in league tables of qpsmtpd codes and SA rules |
72 |
-# - Add in loglevel check |
73 |
-# - parameterise email address for report |
74 |
-# 0.6.15 - bjr - fix columns included in totals |
75 |
-# - sort out domains when more that one email address in recipient field |
76 |
-# 0.6.16 - cb - fix date range bug (http://bugs.contribs.org/show_bug.cgi?id=3366) |
77 |
-# 0.6.17 - cb - avoid numerous re-openings of config db |
78 |
-# 0.6.18 - cb - tidy up options configuration section |
79 |
-# 0.6.19 - cb - rename parse_args => analysis_period, and simplify |
80 |
-# 0.6.20 - bjr - Retofit bjr fixes since file edited by charlie - Details |
81 |
-# - Add Average SA Scores to SA league table, |
82 |
-# - sort junkmail counts, sorted out xfererr for domains |
83 |
-# - Fixed multiple recipients for single emails |
84 |
-# - Fix Report suppression code for qpsmtpd codes etc |
85 |
-# - Added code to save stats to MySQL DB (defaulted to off) |
86 |
-# - Fixed interval so that it analyzes Midnight to midnight |
87 |
-# - Allow varied interval for report |
88 |
-# 0.6.21 - bjr - Move initial test (and create) for mailstats prop before |
89 |
-# first reference to mailstats |
90 |
-# 0.6.22 - bjr - bug fix [SME:3734] |
91 |
-# |
92 |
-# TODO |
93 |
-# ---- |
94 |
-# |
95 |
-# sort out multiple emails recipients, count each one, and log multiple counts |
96 |
-# |
97 |
-# |
98 |
-# |
99 |
############################################################################# |
100 |
# |
101 |
# SMEServer DB usage |
102 |
@@ -123,6 +35,7 @@ |
103 |
use Pod::Usage; |
104 |
use POSIX qw/strftime floor/; |
105 |
use Time::Local; |
106 |
+#use Date::Manip; |
107 |
use Date::Parse; |
108 |
use Time::TAI64; |
109 |
use esmith::ConfigDB; |