diff --git a/abck b/abck index 6179c04..399805e 100755 --- a/abck +++ b/abck @@ -9,7 +9,7 @@ ########## -VERSION = "$Id: abck,v 1.95 2001/07/27 01:45:24 tundra Exp $" +VERSION = "$Id: abck,v 1.96 2001/07/27 02:09:15 tundra Exp $" @@ -35,7 +35,7 @@ DONE = FALSE #################### -# Constants +# General Constants #################### ANS = ";; ANSWER SECTION:" @@ -44,32 +44,41 @@ DIG = "dig -t ptr -x " HIST = ".abck_history" HISTFILE = os.path.join(os.getenv("HOME"), HIST) -HOSTNAME = socket.gethostname() -HOSTADDR = socket.gethostbyname(HOSTNAME) -HOSTTZ = time.tzname LOG = "/var/log/messages" MOS = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] -NOTIFYWHO = ("abuse", "root") -ORG = os.getenv("ORGANIZATION") -PROMPT = "\nLog Record:\n%s\n\nWho Gets Message For: <%s>? %s[%s] " WHO = "whois " #################### -# Prompt And Message Strings +# Constants Used In Outgoing eMail #################### +HOSTNAME = socket.gethostname() +HOSTADDR = socket.gethostbyname(HOSTNAME) +HOSTTZ = time.tzname +NOTIFYWHO = ("abuse", "root") +ORG = os.getenv("ORGANIZATION") +SUBJ = "\"Attempted Intrusion Attempt\"" + +MAILCMD = "mail -s %s" % (SUBJ) MAILMSG = "An *unauthorized* attempt to access one of our computers\n" + \ "has been detected originating from your address space/domain.\n\n" + \ "Our machine, %s, has IP address,\n%s, and is located in the " + \ "%s Time Zone.\n\n" + \ "Our log entry documenting the attempted intrusion\n" + \ - "from your address space/domain, follows:\n\n\"%s\"\n\n" + \ + "from your address space/domain, follows:\n\n%s\n\n" + \ "Please take the necessary steps to remedy this situation.\n" + \ "Thank-You\n" + ORG + "\n" +#################### +# Prompt And Message Strings +#################### + + +PROMPT = "\nLog Record:\n%s\n\nWho Gets Message For: <%s>? %s[%s] " + USAGE = "abck " + VERSION.split()[2] + " " + \ "Copyright (c) 2001, TundraWare Inc. All Rights Reserved.\n" + \ " usage:\n" + \ @@ -179,15 +188,13 @@ def Notify(logrecord, domain): dest=[] + logrecord = "\"" + logrecord + "\"" msg = (MAILMSG % (HOSTNAME, HOSTADDR, "/".join(HOSTTZ), logrecord)) for x in NOTIFYWHO: dest.append(x + "@" + domain) dest.append("root@" + HOSTNAME) - - print msg - print dest - - + + os.popen(MAILCMD + " " + " ".join(dest), "w").write(msg) ####################