Skip to content

Commit

Permalink
experiment with location presentation in email
Browse files Browse the repository at this point in the history
  • Loading branch information
wleightond committed Aug 4, 2024
1 parent 8ccc13e commit 0e371b1
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
2 changes: 2 additions & 0 deletions canarytokens/channel_output_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ def format_report_html(
BasicDetails.pop("useragent")
if "src_ip" in BasicDetails and not BasicDetails["src_ip"]:
BasicDetails.pop("src_ip")
if details.token_type == TokenTypes.PWA and "location" in BasicDetails:
BasicDetails["pwa_location"] = BasicDetails.pop("location")

rendered_html = Template(template_path.open().read()).render(
Title=EmailOutputChannel.DESCRIPTION,
Expand Down
80 changes: 80 additions & 0 deletions templates/emails/notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,86 @@
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]--> {% endif %}
<!-- Location -->{% if BasicDetails.get('pwa_location')] %}
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation"
style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
<tbody>
<tr>
<td style="direction:ltr;font-size:0px;padding:0px 30px 30px;text-align:center;">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" width="600px" ><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:540px;" width="540" bgcolor="#f6f8fb" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div
style="background:#f6f8fb;background-color:#f6f8fb;margin:0px auto;border-radius:16px 16px;max-width:540px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation"
style="background:#f6f8fb;background-color:#f6f8fb;width:100%;border-radius:16px 16px;">
<tbody>
<tr>
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:540px;" ><![endif]-->
<div class="mj-column-per-100 mj-outlook-group-fix"
style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
<table border="0" cellpadding="0" cellspacing="0"
role="presentation" width="100%">
<tbody>
<tr>
<td style="vertical-align:top;padding:0px;">
<table border="0" cellpadding="0" cellspacing="0"
role="presentation" style width="100%">
<tbody>
<tr>
<td align="left"
style="font-size:0px;padding:10px 25px;word-break:break-word;">
<table cellpadding="0"
cellspacing="0" width="100%"
border="0"
style="color:#000000;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;table-layout:auto;width:100%;border:none;">
<tr
style="color:#818a8e;font-size:16px;text-align:left;font-weight:600">
<td style="padding: 0px 10px; width:40px; font-weight:400; vertical-align: middle;"
rowspan="2">
<img align="center"
src="https://{{ BasicDetails['public_domain'] }}/resources/notification-email/default.png"
width="40px">
</td>
<td>
<p
style="font-weight:600;display:block;line-height:1;margin:0;">
Location</p>
<p
style="font-weight:400;color:#060606;margin:0;">Latitude:
{{BasicDetails['pwa_location'].get('latitude', '-')}}</p>
<p
style="font-weight:400;color:#060606;margin:0;">Longitude:
{{BasicDetails['pwa_location'].get('longitude', '-')}}</p>
<p
style="font-weight:400;color:#060606;margin:0;">Accuracy (m):
{{BasicDetails['pwa_location'].get('accuracy', '-')}}</p>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]--> {% endif %}
<!-- Log4Shell hostname -->{% if BasicDetails['log4_shell_computer_name'] %}
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
Expand Down

0 comments on commit 0e371b1

Please sign in to comment.