diff options
-rw-r--r-- | src/emailinfo.py | 4 | ||||
-rwxr-xr-x | src/geoemail.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/emailinfo.py b/src/emailinfo.py index deaa285f..5ff17204 100644 --- a/src/emailinfo.py +++ b/src/emailinfo.py @@ -7,6 +7,7 @@ import email.utils import datetime from weblookuptools import * from email.parser import Parser +from email.utils import getaddresses class EmailInfo: __location = None @@ -36,7 +37,7 @@ class EmailInfo: msg = EmailInfo.parser.parse(file, True) receiveHosts = [] date = False - for line in msg.get_all("Received"): + for line in msg.get_all("Received", []): filteredIps = [] #After the "by" or "for" there is no useful information byIndex = line.find("by") @@ -64,6 +65,7 @@ class EmailInfo: date = datetime.datetime.utcfromtimestamp(email.utils.mktime_tz(email.utils.parsedate_tz(msg.get("Date")))) except: date = False + #recipients = getaddresses(msg.get_all('to', []) + msg.get_all('cc', []) + msg.get_all('bcc', []) + msg.get_all('resent-to', []) + msg.get_all('resent-cc', []) + msg.get_all('resent-bcc', [])) file.close() #Earlier lines come later in the file, so we look at the file reversed receiveHosts.reverse() diff --git a/src/geoemail.py b/src/geoemail.py index b4ee5d2d..b284c3be 100755 --- a/src/geoemail.py +++ b/src/geoemail.py @@ -57,7 +57,9 @@ def processFile(fileName): try: examine = EmailInfo.parseFile(fileName) except: - parser.error("unable to parse %s" % fileName) + if options.debug: + print "unable to parse %s" % fileName + return if options.debug and examine.debug: print fileName + ":", print examine.debug |