scripts: migrate-rules: parse ATT&CK from tag name

This commit is contained in:
William Ballenthin
2020-06-21 17:59:16 -06:00
parent 8f097b883c
commit 5eddc9d3f4

View File

@@ -89,13 +89,15 @@ def main(argv=None):
rule.meta["namespace"] = row["proposed namespace"]
rule.meta["att&ck"] = [
row["ATT&CK"]
]
if row["ATT&CK"] != 'n/a' and row["ATT&CK"] != "":
tag = row["ATT&CK"]
name, _, id = tag.rpartition(" ")
tag = "%s [%s]" % (name, id)
rule.meta["att&ck"] = [tag]
rule.meta["mbc"] = [
row["MBC"]
]
if row["MBC"] != 'n/a' and row["MBC"] != "":
tag = row["MBC"]
rule.meta["mbc"] = [tag]
for rule in rules.values():
namespace = rule.meta.get("namespace")