Skip to content

Commit

Permalink
Display source port in notifications differently
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkst-quinn committed Feb 14, 2025
1 parent 2974490 commit 19756b5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
3 changes: 3 additions & 0 deletions canarytokens/channel_output_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ def format_report_intro(details: TokenAlertDetails):
else:
intro = f"{article} {readable_type} Canarytoken has been triggered."

if details.src_port:
intro = dedent(f"from Source Port {details.src_port}")

if details.channel == "DNS": # TODO: make channel an enum.
intro = dedent(
f"""{intro}
Expand Down
2 changes: 1 addition & 1 deletion canarytokens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ class TokenHit(BaseModel):
# token_type: GeneralHistoryTokenType
time_of_hit: float
src_ip: Optional[str]
src_port: Optional[str]
src_port: Optional[int]
geo_info: Union[GeoIPInfo, GeoIPBogonInfo, None, Literal[""]]
is_tor_relay: Optional[bool]
input_channel: str
Expand Down
21 changes: 0 additions & 21 deletions templates/emails/notification.mjml
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,6 @@
</mj-wrapper>
<mj-raw>{% endif %}</mj-raw>

<!--Source Port -->
<mj-raw>{% if BasicDetails['src_port'] %}</mj-raw>
<mj-wrapper padding="0px 30px 30px" background-color="#FFF">
<mj-section background-color="#f6f8fb" border-radius="16px 16px">
<mj-column width="100%" padding="0px">
<mj-table>

<tr style="color:#818a8e;font-size:16px;text-align:left;font-weight:600">
<td>
<p style="font-weight:600;display:block;line-height:1;margin:0;">Client Source Port</p>
<p style="font-weight:400;color:#060606;margin:0 0 16px 0;">{{BasicDetails['src_port']}}</p>
</td>
</tr>

</mj-table>
</mj-column>
</mj-section>

</mj-wrapper>
<mj-raw>{% endif %}</mj-raw>

<!-- Day & Time -->
<mj-wrapper padding="0px 30px 30px" background-color="#FFF">
<mj-section background-color="#f6f8fb" border-radius="16px 16px">
Expand Down
7 changes: 0 additions & 7 deletions templates/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ <h4 style="text-align: center;">Incident List is Currently Empty</h4>
field not in ['geo_info','is_tor_relay','additional_info','secretkeeper_photo'] %}
{% if field not in ['src_ip','input_channel'] %}
<tr class="info_row">
{% if field == 'src_port'}
<td>
Source Port
</td>
<td>
{{ canarydrop[item][field] }}
</td>
{% if canarydrop['type'] == 'aws_keys' %}
<td>
AWS Access Key ID
Expand Down

0 comments on commit 19756b5

Please sign in to comment.