This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
mail.py
47 lines (37 loc) · 1.46 KB
/
mail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# The Original Code is ADBFuzz.
#
# The Initial Developer of the Original Code is Christian Holler (decoder).
#
# Contributors:
# Christian Holler <[email protected]> (Original Developer)
#
# ***** END LICENSE BLOCK *****
import smtplib
class Mailer:
def __init__(self, config):
self.config = config
def notify(self, issueUUID, issueDesc, miniDump):
msg = ("From: %s\r\nTo: %s\r\n" % (self.config.mailFrom, self.config.mailTo))
msg = msg + "Subject: [ADBFuzz] Issue report: " + issueDesc + "\r\n\r\n"
msg = msg + "Crash UUID: " + issueUUID + "\r\n"
msg = msg + "Instance identifier: " + self.config.id + "\r\n"
msg = msg + "\r\n"
if miniDump != None:
msg = msg + "Crash trace:" + "\r\n"
crashTrace = miniDump.getSymbolizedCrashTrace()
for (frameNum, frameAddr, frameFile) in crashTrace:
msg = msg + " " + frameNum + " " + frameAddr + " " + frameFile + "\r\n"
server = smtplib.SMTP(self.config.SMTPHost)
server.set_debuglevel(1)
server.sendmail(self.config.mailFrom, [ self.config.mailTo ], msg)
server.quit()
return
if __name__ == "__main__":
raise Exception("This module cannot run standalone, but is used by ADBFuzz")