diff options
| -rwxr-xr-x | bin/emailcanary | 7 | ||||
| -rw-r--r-- | emailcanary/emailutils.py | 2 | ||||
| -rw-r--r-- | setup.py | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/bin/emailcanary b/bin/emailcanary index 46b47e9..c8d305c 100755 --- a/bin/emailcanary +++ b/bin/emailcanary @@ -16,6 +16,7 @@ def parse_args(): parser.add_argument('-d', '--database', default='/etc/emailcanary.db', help='Specify the database to use.') parser.add_argument('-s', '--smtp', default='localhost:465', help='SMTP Server to send chirps to.') parser.add_argument('-f', '--from', dest='fromaddress', help='Specify the email address to send the ping from.') + parser.add_argument('-t', '--threshold', dest='threshold', default='1', type=int, help='The minimum number of failures before reporting.') group = parser.add_mutually_exclusive_group(required=True) group.add_argument('--chirp', metavar='listAddress', help='Send an email to the given canary list address.') @@ -63,11 +64,11 @@ def remove(db, listAddress, recepients): db.remove_account(listAddress, address) return SUCCESS -def check(db, birdie, listAddress): +def check(db, birdie, listAddress, threshold): missing = birdie.check(listAddress) missing = [x for x in missing if x[3].total_seconds() < 86400] missing = [x for x in missing if x[3].total_seconds() > 3600] - if len(missing) == 0: + if len(missing) < threshold: return SUCCESS print("list recepient uuid time") for chirp in missing: @@ -100,7 +101,7 @@ def main(): birdie.chirp(args.chirp) return SUCCESS elif args.check: - return check(db, birdie, args.check) + return check(db, birdie, args.check, args.threshold) else: raise Exception('Unknown action') diff --git a/emailcanary/emailutils.py b/emailcanary/emailutils.py index 2358a3a..13cd1c3 100644 --- a/emailcanary/emailutils.py +++ b/emailcanary/emailutils.py @@ -38,7 +38,7 @@ def get_message(mail, uid): def delete_message(mail, uid): if mail is None: return - result = mail.uid('store', uid, '+FLAGS', '(\Deleted)') + result = mail.uid('store', uid, '+FLAGS', r'(\Deleted)') def close(mail): if mail is None: @@ -2,12 +2,13 @@ from setuptools import setup, find_packages setup(name='emailcanary', - version='0.1', + version='0.3', author='Jesse Morgan', author_email='jesse@jesterpm.net', url='https://jesterpm.net', download_url='http://www.my_program.org/files/', description='Email Canary sends emails to a distribution list and checks for proper distribution.', + long_description='', packages = find_packages(), include_package_data = True, |
