Skip to content

Commit

Permalink
Upgrade documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ygalnezri committed Jan 8, 2025
1 parent d6c650a commit 390441e
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 28 deletions.
33 changes: 18 additions & 15 deletions Watcher/Watcher/common/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def generate_ref():
ref = datetime.now().strftime("%y%m%d") + "-" + str(token_hex(3))[:5]
return ref

SLACK_CHANNEL = getattr(settings, 'SLACK_CHANNEL', '')
CITADEL_ROOM_ID = getattr(settings, 'CITADEL_ROOM_ID', '')
SUBJECT_TAG_SITE_MONITORING = getattr(settings, 'SUBJECT_TAG_SITE_MONITORING', '')

# Configuration for Slack
APP_CONFIG_SLACK = {
Expand All @@ -36,7 +39,7 @@ def generate_ref():
"{words_list}\n\n"
"Please, find more details <{details_url}|here>."
),
'channel': settings.SLACK_CHANNEL,
'channel': SLACK_CHANNEL,
'url_suffix': '#/',
},
'data_leak': {
Expand All @@ -48,7 +51,7 @@ def generate_ref():
"*• Source:* {url}\n\n"
"Please, find more details <{details_url}|here>."
),
'channel': settings.SLACK_CHANNEL,
'channel': SLACK_CHANNEL,
'url_suffix': '#data_leak',
},
'data_leak_group': {
Expand All @@ -58,12 +61,12 @@ def generate_ref():
"*{alerts_number}* new data leakage alerts have been detected for the keyword *{keyword}*\n\n"
"Please, find more details <{details_url}|here>."
),
'channel': settings.SLACK_CHANNEL,
'channel': SLACK_CHANNEL,
'url_suffix': '#data_leak',
},
'website_monitoring': {
'content_template': (
f"*[{settings.SUBJECT_TAG_SITE_MONITORING}" "{ticket_id}] 🔔 {alert_type} on {domain_name_sanitized} 🔔*\n\n"
f"*[{SUBJECT_TAG_SITE_MONITORING}" "{ticket_id}] 🔔 {alert_type} on {domain_name_sanitized} 🔔*\n\n"
"Dear team,\n\n"
"Please find the new incident detected below:\n\n"
"*• Difference Score:* {difference_score}\n"
Expand All @@ -77,7 +80,7 @@ def generate_ref():
"*• Old Mail Server:* {old_mail_A_record_ip}\n\n"
"Please, find more details <{details_url}|here>."
),
'channel': settings.SLACK_CHANNEL,
'channel': SLACK_CHANNEL,
'url_suffix': '#/website_monitoring/',
},
'dns_finder': {
Expand All @@ -91,7 +94,7 @@ def generate_ref():
"*• Fuzzer:* {alert.dns_twisted.fuzzer}\n\n"
"Please, find more details <{details_url}|here>."
),
'channel': settings.SLACK_CHANNEL,
'channel': SLACK_CHANNEL,
'url_suffix': '#/dns_finder/',
},
'dns_finder_group': {
Expand All @@ -101,7 +104,7 @@ def generate_ref():
"*{alerts_number}* New DNS Twisted Alerts for *{dns_domain_name_sanitized_group}* asset.\n\n"
"Please, find more details <{details_url}|here>."
),
'channel': settings.SLACK_CHANNEL,
'channel': SLACK_CHANNEL,
'url_suffix': '#/dns_finder/',
},
}
Expand All @@ -116,7 +119,7 @@ def generate_ref():
"<ul><strong>{words_list}</strong></ul>"
"<p>Please, find more details <a href='{details_url}'>here</a>.</p>"
),
'citadel_room_id': settings.CITADEL_ROOM_ID,
'citadel_room_id': CITADEL_ROOM_ID,
'url_suffix': '#/',
},
'data_leak': {
Expand All @@ -130,7 +133,7 @@ def generate_ref():
"</ul>"
"<p>Please, find more details <a href='{details_url}'>here</a>.</p>"
),
'citadel_room_id': settings.CITADEL_ROOM_ID,
'citadel_room_id': CITADEL_ROOM_ID,
'url_suffix': '#data_leak',
},
'data_leak_group': {
Expand All @@ -140,12 +143,12 @@ def generate_ref():
"<p><strong>{alerts_number}</strong> new data leakage alerts have been detected for the keyword <strong>{keyword}</strong>.</p>"
"<p>Please, find more details <a href='{details_url}'>here</a>.</p>"
),
'citadel_room_id': settings.CITADEL_ROOM_ID,
'citadel_room_id': CITADEL_ROOM_ID,
'url_suffix': '#data_leak',
},
'website_monitoring': {
'content_template': (
f"<p><strong><h4>[{settings.SUBJECT_TAG_SITE_MONITORING}{{ticket_id}}] 🔔 {{alert_type}} on {{domain_name_sanitized}} 🔔</h4></strong></p>"
f"<p><strong><h4>[{SUBJECT_TAG_SITE_MONITORING}{{ticket_id}}] 🔔 {{alert_type}} on {{domain_name_sanitized}} 🔔</h4></strong></p>"
"<p>Dear team,</p>"
"<p>Please find the new incident detected below:</p>"
"<ul>"
Expand All @@ -161,7 +164,7 @@ def generate_ref():
"</ul>"
"<p>Please, find more details <a href='{details_url}'>here</a>.</p>"
),
'citadel_room_id': settings.CITADEL_ROOM_ID,
'citadel_room_id': CITADEL_ROOM_ID,
'url_suffix': '#/website_monitoring/',
},
'dns_finder': {
Expand All @@ -177,7 +180,7 @@ def generate_ref():
"</ul>"
"<p>Please, find more details <a href='{details_url}'>here</a>.</p>"
),
'citadel_room_id': settings.CITADEL_ROOM_ID,
'citadel_room_id': CITADEL_ROOM_ID,
'url_suffix': '#/dns_finder/',
},
'dns_finder_group': {
Expand All @@ -187,7 +190,7 @@ def generate_ref():
"<p><strong>{alerts_number}</strong> New DNS Twisted Alerts for <strong>{dns_domain_name_sanitized_group}</strong> asset.</p>"
"<p>Please, find more details <a href='{details_url}'>here</a>.</p>"
),
'citadel_room_id': settings.CITADEL_ROOM_ID,
'citadel_room_id': CITADEL_ROOM_ID,
'url_suffix': '#/dns_finder/',
},
}
Expand Down Expand Up @@ -267,7 +270,7 @@ def generate_ref():
'template_func': get_data_leak_group_template,
},
'website_monitoring': {
'subject': '[' + settings.SUBJECT_TAG_SITE_MONITORING + '{ticket_id}] {alert_type} on {domain_name_sanitized}',
'subject': '[' + SUBJECT_TAG_SITE_MONITORING + '{ticket_id}] {alert_type} on {domain_name_sanitized}',
'template_func': get_site_monitoring_template,
},
'dns_finder': {
Expand Down
5 changes: 1 addition & 4 deletions Watcher/Watcher/common/utils/send_thehive_alerts.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import requests
from django.conf import settings
from django.utils import timezone
from common.utils.update_thehive import (
handle_alert_or_case,
create_new_alert
)
from common.utils.update_thehive import handle_alert_or_case, create_new_alert
from site_monitoring.models import Site


Expand Down
Binary file modified Watcher/docs/_build/doctrees/README.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/modules/common_core.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/modules/data_leak_core.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/modules/dns_finder_core.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/modules/site_monitoring_core.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/modules/site_monitoring_misp.doctree
Binary file not shown.
Binary file modified Watcher/docs/_build/doctrees/modules/threats_watcher_core.doctree
Binary file not shown.
38 changes: 34 additions & 4 deletions Watcher/docs/_build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ <h1 id="index">Index</h1>
<div class="genindex-jumpbox">
<a href="#C"><strong>C</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#I"><strong>I</strong></a>
| <a href="#L"><strong>L</strong></a>
| <a href="#M"><strong>M</strong></a>
Expand All @@ -110,10 +111,10 @@ <h2 id="C">C</h2>
</li>
<li><a href="modules/data_leak_core.html#Watcher.data_leak.core.check_pastebin">check_pastebin() (in module Watcher.data_leak.core)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/data_leak_core.html#Watcher.data_leak.core.check_searx">check_searx() (in module Watcher.data_leak.core)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/data_leak_core.html#Watcher.data_leak.core.check_urls">check_urls() (in module Watcher.data_leak.core)</a>
</li>
<li><a href="modules/data_leak_core.html#Watcher.data_leak.core.cleanup">cleanup() (in module Watcher.data_leak.core)</a>
Expand All @@ -122,6 +123,8 @@ <h2 id="C">C</h2>
<li><a href="modules/threats_watcher_core.html#Watcher.threats_watcher.core.cleanup">(in module Watcher.threats_watcher.core)</a>
</li>
</ul></li>
<li><a href="modules/common_core.html#Watcher.common.core.collect_observables">collect_observables() (in module Watcher.common.core)</a>
</li>
<li><a href="modules/site_monitoring_core.html#Watcher.site_monitoring.core.create_alert">create_alert() (in module Watcher.site_monitoring.core)</a>
</li>
<li><a href="modules/site_monitoring_misp.html#Watcher.site_monitoring.misp.create_attributes">create_attributes() (in module Watcher.site_monitoring.misp)</a>
Expand All @@ -145,6 +148,14 @@ <h2 id="F">F</h2>
</ul></td>
</tr></table>

<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/common_core.html#Watcher.common.core.generate_ref">generate_ref() (in module Watcher.common.core)</a>
</li>
</ul></td>
</tr></table>

<h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down Expand Up @@ -176,6 +187,8 @@ <h2 id="M">M</h2>
module

<ul>
<li><a href="modules/common_core.html#module-Watcher.common.core">Watcher.common.core</a>
</li>
<li><a href="modules/data_leak_core.html#module-Watcher.data_leak.core">Watcher.data_leak.core</a>
</li>
<li><a href="modules/dns_finder_core.html#module-Watcher.dns_finder.core">Watcher.dns_finder.core</a>
Expand Down Expand Up @@ -212,6 +225,10 @@ <h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/threats_watcher_core.html#Watcher.threats_watcher.core.remove_banned_words">remove_banned_words() (in module Watcher.threats_watcher.core)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/common_core.html#Watcher.common.core.remove_html_tags">remove_html_tags() (in module Watcher.common.core)</a>
</li>
</ul></td>
</tr></table>
Expand All @@ -220,6 +237,10 @@ <h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/site_monitoring_misp.html#Watcher.site_monitoring.misp.search_attributes">search_attributes() (in module Watcher.site_monitoring.misp)</a>
</li>
<li><a href="modules/common_core.html#Watcher.common.core.send_app_specific_notifications">send_app_specific_notifications() (in module Watcher.common.core)</a>
</li>
<li><a href="modules/common_core.html#Watcher.common.core.send_app_specific_notifications_group">send_app_specific_notifications_group() (in module Watcher.common.core)</a>
</li>
<li><a href="modules/data_leak_core.html#Watcher.data_leak.core.send_data_leak_notifications">send_data_leak_notifications() (in module Watcher.data_leak.core)</a>
</li>
Expand All @@ -231,6 +252,8 @@ <h2 id="S">S</h2>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="modules/common_core.html#Watcher.common.core.send_only_thehive_notifications">send_only_thehive_notifications() (in module Watcher.common.core)</a>
</li>
<li><a href="modules/threats_watcher_core.html#Watcher.threats_watcher.core.send_threats_watcher_notifications">send_threats_watcher_notifications() (in module Watcher.threats_watcher.core)</a>
</li>
<li><a href="modules/site_monitoring_core.html#Watcher.site_monitoring.core.send_website_monitoring_notifications">send_website_monitoring_notifications() (in module Watcher.site_monitoring.core)</a>
Expand Down Expand Up @@ -272,6 +295,13 @@ <h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
Watcher.common.core

<ul>
<li><a href="modules/common_core.html#module-Watcher.common.core">module</a>
</li>
</ul></li>
<li>
Watcher.data_leak.core

<ul>
Expand All @@ -285,15 +315,15 @@ <h2 id="W">W</h2>
<li><a href="modules/dns_finder_core.html#module-Watcher.dns_finder.core">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
Watcher.site_monitoring.core

<ul>
<li><a href="modules/site_monitoring_core.html#module-Watcher.site_monitoring.core">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
Watcher.site_monitoring.misp

Expand Down
10 changes: 9 additions & 1 deletion Watcher/docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,15 @@ <h1>Welcome to Watcher’s documentation!<a class="headerlink" href="#welcome-to
<li class="toctree-l2"><a class="reference internal" href="modules/site_monitoring_misp.html#Watcher.site_monitoring.misp.update_attributes"><code class="docutils literal notranslate"><span class="pre">update_attributes()</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="modules/common_core.html">Common - Core Algorithm</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules/common_core.html">Common - Core Algorithm</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules/common_core.html#Watcher.common.core.collect_observables"><code class="docutils literal notranslate"><span class="pre">collect_observables()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/common_core.html#Watcher.common.core.generate_ref"><code class="docutils literal notranslate"><span class="pre">generate_ref()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/common_core.html#Watcher.common.core.remove_html_tags"><code class="docutils literal notranslate"><span class="pre">remove_html_tags()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/common_core.html#Watcher.common.core.send_app_specific_notifications"><code class="docutils literal notranslate"><span class="pre">send_app_specific_notifications()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/common_core.html#Watcher.common.core.send_app_specific_notifications_group"><code class="docutils literal notranslate"><span class="pre">send_app_specific_notifications_group()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/common_core.html#Watcher.common.core.send_only_thehive_notifications"><code class="docutils literal notranslate"><span class="pre">send_only_thehive_notifications()</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="modules/threats_watcher_core.html">Threats Watcher - Core Algorithm</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules/threats_watcher_core.html#Watcher.threats_watcher.core.cleanup"><code class="docutils literal notranslate"><span class="pre">cleanup()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="modules/threats_watcher_core.html#Watcher.threats_watcher.core.fetch_last_posts"><code class="docutils literal notranslate"><span class="pre">fetch_last_posts()</span></code></a></li>
Expand Down
Loading

0 comments on commit 390441e

Please sign in to comment.