summaryrefslogtreecommitdiff
path: root/bin/emailcanary
diff options
context:
space:
mode:
Diffstat (limited to 'bin/emailcanary')
-rwxr-xr-xbin/emailcanary8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/emailcanary b/bin/emailcanary
index 706f633..46b47e9 100755
--- a/bin/emailcanary
+++ b/bin/emailcanary
@@ -3,6 +3,7 @@
import argparse
import sys
import smtplib
+import time
import traceback
from emailcanary import canarydb
from emailcanary import canary
@@ -20,6 +21,7 @@ def parse_args():
group.add_argument('--chirp', metavar='listAddress', help='Send an email to the given canary list address.')
group.add_argument('--check', metavar='listAddress', help='Check the recepient addresses for the list address.')
group.add_argument('--add', nargs=4, metavar=('listAddress', 'address', 'imapserver', 'password'), help='Add a new recepient and list.')
+ group.add_argument('--mute', nargs=3, metavar=('listAddress', 'address', 'days'), help='Mute errors for the account for the given number of days.')
group.add_argument('--remove', nargs='+', metavar=('listAddress', 'address'), help='Remove recepients from the list.')
group.add_argument('--list', action='store_true', help='List all configured addresses.')
@@ -50,6 +52,10 @@ def add(db, listAddress, recepient, imapserver, password):
db.add_account(listAddress, recepient, imapserver, password)
return SUCCESS
+def mute(db, listAddress, recepient, days):
+ db.mute_account(listAddress, recepient, time.time() + 86400 * days)
+ return SUCCESS
+
def remove(db, listAddress, recepients):
if len(recepients) == 0:
recepients = db.get_accounts(listAddress)
@@ -83,6 +89,8 @@ def main():
return list(db)
elif args.add:
return add(db, args.add[0], args.add[1], args.add[2], args.add[3])
+ elif args.mute:
+ return mute(db, args.mute[0], args.mute[1], int(args.mute[2]))
elif args.remove:
return remove(db, args.remove[0], args.remove[1:])
else: