This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
EmailContentGen.py
49 lines (41 loc) · 1.54 KB
/
EmailContentGen.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
48
49
from yattag import Doc
from CacheHandler import load_events
def HTML_Template(log_document):
events = load_events()
doc, tag, text = Doc().tagtext()
try:
with tag('div', dir='ltr'):
with tag('div',align='center'):
with tag('h1'):
text('! Important Alert from Shoham SIEM System !')
doc.stag('br')
with tag('div', align='left'):
with tag('h3'):
text('Report details:')
doc.stag('br')
with tag('b'):
text('Event name: ')
text(events[log_document['event']]['name'])
doc.stag('br')
with tag('b'):
text('Description: ')
text(events[log_document['event']]['description'])
doc.stag('br')
with tag('b'):
text('Type: ')
text(log_document['type'])
doc.stag('br')
with tag('b'):
text('Alerted time: ')
text(str(log_document['offense_close_time']))
doc.stag('br')
with tag('b'):
text('Devices included: ')
doc.stag('br')
with tag('ul'):
for device in log_document['device']:
with tag('li'):
text(device)
return doc.getvalue()
except Exception as e:
print("Exception in HTML: " + str(e))