new: [tools] add a skip list for large taxonomies or specific topic
A new option has been added `--disable-skip-list` to disable it if requiredpull/231/head
parent
fb1cd292dc
commit
c60bf07d19
|
@ -4,7 +4,7 @@
|
||||||
# Python script parsing the MISP taxonomies expressed in Machine Tags (Triple
|
# Python script parsing the MISP taxonomies expressed in Machine Tags (Triple
|
||||||
# Tags) to list all valid tags from a specific taxonomy.
|
# Tags) to list all valid tags from a specific taxonomy.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2017 Alexandre Dulaunoy - a@foo.be
|
# Copyright (c) 2015-2022 Alexandre Dulaunoy - a@foo.be
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without modification,
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
# are permitted provided that the following conditions are met:
|
# are permitted provided that the following conditions are met:
|
||||||
|
@ -30,7 +30,9 @@ import json
|
||||||
import os.path
|
import os.path
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
skip_list = ['death-possibilities']
|
||||||
taxonomies = []
|
taxonomies = []
|
||||||
|
|
||||||
# Get our current directory from file location
|
# Get our current directory from file location
|
||||||
|
@ -47,8 +49,12 @@ argParser.add_argument('-e', action='store_true', help='Include expanded tags')
|
||||||
argParser.add_argument('-a', action='store_true', help='Generate asciidoctor document from MISP taxonomies')
|
argParser.add_argument('-a', action='store_true', help='Generate asciidoctor document from MISP taxonomies')
|
||||||
argParser.add_argument('-v', action='store_true', help='Include descriptions')
|
argParser.add_argument('-v', action='store_true', help='Include descriptions')
|
||||||
argParser.add_argument('-n', default=False, help='Show only the specified namespace')
|
argParser.add_argument('-n', default=False, help='Show only the specified namespace')
|
||||||
|
argParser.add_argument('--disable-skip-list', default=False, action='store_true', help='disable default skip list')
|
||||||
args = argParser.parse_args()
|
args = argParser.parse_args()
|
||||||
|
|
||||||
|
if args.disable_skip_list:
|
||||||
|
skip_list = ''
|
||||||
|
|
||||||
doc = ''
|
doc = ''
|
||||||
if args.a:
|
if args.a:
|
||||||
dedication = "\n[dedication]\n== Funding and Support\nThe MISP project is financially and resource supported by https://www.circl.lu/[CIRCL Computer Incident Response Center Luxembourg ].\n\nimage:{images-misp}logo.png[CIRCL logo]\n\nA CEF (Connecting Europe Facility) funding under CEF-TC-2016-3 - Cyber Security has been granted from 1st September 2017 until 31th August 2019 as ***Improving MISP as building blocks for next-generation information sharing***.\n\nimage:{images-misp}en_cef.png[CEF funding]\n\nIf you are interested to co-fund projects around MISP, feel free to get in touch with us.\n\n"
|
dedication = "\n[dedication]\n== Funding and Support\nThe MISP project is financially and resource supported by https://www.circl.lu/[CIRCL Computer Incident Response Center Luxembourg ].\n\nimage:{images-misp}logo.png[CIRCL logo]\n\nA CEF (Connecting Europe Facility) funding under CEF-TC-2016-3 - Cyber Security has been granted from 1st September 2017 until 31th August 2019 as ***Improving MISP as building blocks for next-generation information sharing***.\n\nimage:{images-misp}en_cef.png[CEF funding]\n\nIf you are interested to co-fund projects around MISP, feel free to get in touch with us.\n\n"
|
||||||
|
@ -121,6 +127,9 @@ def machineTag(namespace=False, predicate=False, value=None):
|
||||||
|
|
||||||
|
|
||||||
for taxonomy in taxonomies:
|
for taxonomy in taxonomies:
|
||||||
|
if taxonomy in skip_list:
|
||||||
|
sys.stderr.write(f"Skip {taxonomy}")
|
||||||
|
continue
|
||||||
filename = os.path.join(thisDir, "../", taxonomy, "machinetag.json")
|
filename = os.path.join(thisDir, "../", taxonomy, "machinetag.json")
|
||||||
with open(filename) as fp:
|
with open(filename) as fp:
|
||||||
t = json.load(fp)
|
t = json.load(fp)
|
||||||
|
|
Loading…
Reference in New Issue