Skip to content

Commit 84dd996

Browse files
authored
Merge pull request #64 from rubinatorz/master
Added ICS campaigns and some ICS fixes
2 parents abb5ce1 + 07581c1 commit 84dd996

1 file changed

Lines changed: 48 additions & 6 deletions

File tree

attackcti/attack_api.py

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def get_enterprise(self, stix_format=True):
352352
"matrix": Filter("type", "=", "x-mitre-matrix"),
353353
"identity": Filter("type", "=", "identity"),
354354
"marking-definition": Filter("type", "=", "marking-definition"),
355-
"campaign": self.get_enterprise_campaigns
355+
"campaigns": self.get_enterprise_campaigns
356356
}
357357
enterprise_stix_objects = dict()
358358
for key in enterprise_filter_objects:
@@ -688,7 +688,7 @@ def get_mobile(self, stix_format=True):
688688
return mobile_stix_objects
689689

690690
def get_mobile_campaigns(self, skip_revoked_deprecated=True, stix_format=True):
691-
""" Extracts all the available techniques STIX objects in the Mobile ATT&CK matrix
691+
""" Extracts all the available campaign STIX objects in the Mobile ATT&CK matrix
692692
693693
Args:
694694
skip_revoked_deprecated (bool): default True. Skip revoked and deprecated STIX objects.
@@ -842,12 +842,18 @@ def get_ics(self, stix_format=True):
842842
"""
843843
ics_filter_objects = {
844844
"techniques": self.get_ics_techniques,
845+
"data-component": self.get_ics_data_components,
845846
"mitigations": self.get_ics_mitigations,
846847
"groups": self.get_ics_groups,
847848
"malware": self.get_ics_malware,
849+
"tools": self.get_ics_tools,
850+
"data-source": self.get_ics_data_sources,
848851
"relationships": self.get_ics_relationships,
849852
"tactics": self.get_ics_tactics,
850-
"matrix": Filter("type", "=", "x-mitre-matrix")
853+
"matrix": Filter("type", "=", "x-mitre-matrix"),
854+
"identity": Filter("type", "=", "identity"),
855+
"marking-definition": Filter("type", "=", "marking-definition"),
856+
"campaigns": self.get_ics_campaigns
851857
}
852858
ics_stix_objects = {}
853859
for key in ics_filter_objects:
@@ -856,6 +862,26 @@ def get_ics(self, stix_format=True):
856862
ics_stix_objects[key] = self.translate_stix_objects(ics_stix_objects[key])
857863
return ics_stix_objects
858864

865+
def get_ics_campaigns(self, skip_revoked_deprecated=True, stix_format=True):
866+
""" Extracts all the available techniques STIX objects in the ICS ATT&CK matrix
867+
868+
Args:
869+
skip_revoked_deprecated (bool): default True. Skip revoked and deprecated STIX objects.
870+
stix_format (bool): Returns results in original STIX format or friendly syntax (e.g. 'attack-pattern' or 'technique')
871+
872+
Returns:
873+
List of STIX objects
874+
"""
875+
876+
ics_campaigns = self.TC_ICS_SOURCE.query(Filter("type", "=", "campaign"))
877+
878+
if skip_revoked_deprecated:
879+
ics_campaigns = self.remove_revoked_deprecated(ics_campaigns)
880+
881+
if not stix_format:
882+
ics_campaigns = self.translate_stix_objects(ics_campaigns)
883+
return ics_campaigns
884+
859885
def get_ics_techniques(self, skip_revoked_deprecated=True, include_subtechniques=True, stix_format=True):
860886
""" Extracts all the available techniques STIX objects in the ICS ATT&CK matrix
861887
@@ -948,6 +974,21 @@ def get_ics_malware(self, stix_format=True):
948974
ics_malware = self.translate_stix_objects(ics_malware)
949975
return ics_malware
950976

977+
def get_ics_tools(self, stix_format=True):
978+
"""Extracts all the available tools STIX objects in the ICS ATT&CK matrix
979+
980+
Args:
981+
stix_format (bool): Returns results in original STIX format or friendly syntax (e.g. 'attack-pattern' or 'technique')
982+
983+
Returns:
984+
List of STIX objects
985+
986+
"""
987+
ics_tools = self.TC_ICS_SOURCE.query(Filter("type", "=", "tool"))
988+
if not stix_format:
989+
ics_tools = self.translate_stix_objects(ics_tools)
990+
return ics_tools
991+
951992
def get_ics_relationships(self, stix_format=True):
952993
""" Extracts all the available relationships STIX objects in the ICS ATT&CK matrix
953994
@@ -1021,9 +1062,10 @@ def get_campaigns(self, skip_revoked_deprecated=True, stix_format=True):
10211062

10221063
enterprise_campaigns = self.get_enterprise_campaigns()
10231064
mobile_campaigns = self.get_mobile_campaigns()
1024-
for mc in mobile_campaigns:
1025-
if mc not in enterprise_campaigns:
1026-
enterprise_campaigns.append(mc)
1065+
ics_campaigns = self.get_ics_campaigns()
1066+
for c in mobile_campaigns + ics_campaigns:
1067+
if c not in enterprise_campaigns:
1068+
enterprise_campaigns.append(c)
10271069

10281070
if skip_revoked_deprecated:
10291071
enterprise_campaigns = self.remove_revoked_deprecated(enterprise_campaigns)

0 commit comments

Comments
 (0)