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["namespace"] = row["proposed namespace"]
rule.meta["att&ck"] = [ if row["ATT&CK"] != 'n/a' and row["ATT&CK"] != "":
row["ATT&CK"] tag = row["ATT&CK"]
] name, _, id = tag.rpartition(" ")
tag = "%s [%s]" % (name, id)
rule.meta["att&ck"] = [tag]
rule.meta["mbc"] = [ if row["MBC"] != 'n/a' and row["MBC"] != "":
row["MBC"] tag = row["MBC"]
] rule.meta["mbc"] = [tag]
for rule in rules.values(): for rule in rules.values():
namespace = rule.meta.get("namespace") namespace = rule.meta.get("namespace")