From 87cdbde844fb5c953230b815e84362693d274f3a Mon Sep 17 00:00:00 2001 From: Stephen Campbell Date: Sat, 18 May 2024 09:29:22 -0400 Subject: [PATCH] Add URLs to markdown pages for incidents --- CODE/generate_DISARM_pages.py | 15 +++++++++++++++ CODE/page_templates/template_incident.md | 2 ++ 2 files changed, 17 insertions(+) diff --git a/CODE/generate_DISARM_pages.py b/CODE/generate_DISARM_pages.py index 93df35f..b8cea8c 100644 --- a/CODE/generate_DISARM_pages.py +++ b/CODE/generate_DISARM_pages.py @@ -209,6 +209,20 @@ class Disarm: return incidentstr + def create_incident_urls_string(self, incidentid): + + urlsstr = ''' +| Reference | +''' + + urlsrow = '| [{0}]({0})|\n' + incident = self.df_incidents[self.df_incidents['disarm_id']==incidentid] + urls_series = incident['urls'].series.str.split(' ',expand=True).explode + for u in urls_series: + urlsstr += urlsrow.format(u) + return urlsstr + + def create_incident_techniques_string(self, incidentid): techstr = ''' @@ -492,6 +506,7 @@ class Disarm: tocountry=row['found_in_country'], foundvia=row['found_via'], dateadded=row['when_added'], + urls=self.create_incident_urls_string(row['disarm_id'])), techniques=self.create_incident_techniques_string(row['disarm_id'])) if objecttype == 'actortype': metatext = template.format(type = 'Actor', id=row['disarm_id'], name=row['name'], diff --git a/CODE/page_templates/template_incident.md b/CODE/page_templates/template_incident.md index 95bf2b2..70d3e4a 100644 --- a/CODE/page_templates/template_incident.md +++ b/CODE/page_templates/template_incident.md @@ -11,6 +11,8 @@ * **Found via:** {foundvia} * **Date added:** {dateadded} + +{urls} {techniques}