small enhancements, fix property for TLPMarking

master
Emmanuelle Vargas-Gonzalez 2018-11-29 10:26:20 -05:00
parent 79c9d85072
commit 6f897bc91d
2 changed files with 7 additions and 6 deletions

View File

@ -293,12 +293,13 @@ def _collect_stix2_mappings():
prefix = str(top_level_module.__name__) + '.'
for module_loader, name, is_pkg in pkgutil.walk_packages(path=path, prefix=prefix):
ver = name.split('.')[1]
if re.match(r'^stix2\.v2[0-9]$', name) and is_pkg:
mod = importlib.import_module(name, str(top_level_module.__name__))
STIX2_OBJ_MAPS[name.split('.')[1]] = {}
STIX2_OBJ_MAPS[name.split('.')[1]]['objects'] = mod.OBJ_MAP
STIX2_OBJ_MAPS[name.split('.')[1]]['observables'] = mod.OBJ_MAP_OBSERVABLE
STIX2_OBJ_MAPS[name.split('.')[1]]['observable-extensions'] = mod.EXT_MAP
STIX2_OBJ_MAPS[ver] = {}
STIX2_OBJ_MAPS[ver]['objects'] = mod.OBJ_MAP
STIX2_OBJ_MAPS[ver]['observables'] = mod.OBJ_MAP_OBSERVABLE
STIX2_OBJ_MAPS[ver]['observable-extensions'] = mod.EXT_MAP
elif re.match(r'^stix2\.v2[0-9]\.common$', name) and is_pkg is False:
mod = importlib.import_module(name, str(top_level_module.__name__))
STIX2_OBJ_MAPS[name.split('.')[1]]['markings'] = mod.OBJ_MAP_MARKING
STIX2_OBJ_MAPS[ver]['markings'] = mod.OBJ_MAP_MARKING

View File

@ -98,7 +98,7 @@ class TLPMarking(_STIXBase):
_type = 'tlp'
_properties = OrderedDict([
('tlp', Property(required=True)),
('tlp', StringProperty(required=True)),
])