# HG changeset patch # User Pascal Volk # Date 1259329931 0 # Node ID 723b4c4e15cb7afa41b8f20c7f2a398394e9135e # Parent 65590f05bb976f6e0818edb3190525b4bc770775 Set/updated descriptions and error messages. NiXSapmSum: Converted to new-style class, added __slots__ diff -r 65590f05bb97 -r 723b4c4e15cb nixspamsum --- a/nixspamsum Fri Nov 13 05:54:37 2009 +0000 +++ b/nixspamsum Fri Nov 27 13:52:11 2009 +0000 @@ -10,8 +10,12 @@ import os import re -class NiXSapmSum: - """Do sth ...""" +class NiXSapmSum(object): + """ + Small log parser class to parse and summarize NiX Spam DNSBL lookup + based rejects from a mail log file. + """ + __slots__ = ('_doms', '_mxs', '_repo') """Regular expression pattern for mail logs from Postfix""" RE_PF = '''^[\w\s:-]{17,80}\spostfix\/smtpd\[[\d]{3,5}\]: NOQUEUE: reject:.*blocked using ix.dnsbl.manitu.net; Spam sent to the mailhost ((?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}) was detected by NiX Spam.*$''' @@ -53,7 +57,7 @@ def getOptionParser(): from optparse import OptionParser - description = 'do something ...' + description = 'NiX Spam DNSBL lookup based rejects summarizer' usage = 'usage: %prog [options] maillog [maillog [...]]' version = '%prog '+__version__ parser = OptionParser(description=description,usage=usage,version=version) @@ -114,7 +118,7 @@ else: domains = nixspamsum.getMXs() if not len(domains): - print "No Nix Spam RBL rejects found" + print "No NiX Spam DNSBL rejects found" return from cStringIO import StringIO @@ -140,7 +144,7 @@ if opts.oFormat not in ('csv', 'table'): parser.error("Output format '%s' is not supported" % opts.oFormat) if len(args) < 1: - parser.error('No logfiles specified') + parser.error('No log file specified') nixss = NiXSapmSum() nixss.setLogFormat(opts.format) for fn in args: