fix: [stix2 export] Fixed TLP marking definition objects creation

pull/4821/head
chrisr3d 2019-06-28 12:44:57 +02:00
parent b40fa0d69f
commit 4d590160da
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
2 changed files with 12 additions and 4 deletions

View File

@ -676,10 +676,15 @@ class StixBuilder():
'from_object']
def create_marking(self, tag):
id = 'marking-definition--%s' % uuid.uuid4()
definition_type, definition = tag.split(':')
self.markings[tag] = {'type': 'marking-definition', 'id': id, 'definition_type': definition_type,
'definition': {definition_type: definition}}
try:
marking_definition = globals()[tlp_markings[tag]]
id = marking_definition.id
except KeyError:
id = 'marking-definition--%s' % uuid.uuid4()
definition_type, definition = tag.split(':')
marking_definition = {'type': 'marking-definition', 'id': id, 'definition_type': definition_type,
'definition': {definition_type: definition}}
self.markings[tag] = marking_definition
return id
@staticmethod

View File

@ -360,6 +360,9 @@ x509mapping = {'pubkey-info-algorithm': 'subject_public_key_algorithm', 'subject
defineProtocols = {'80': 'http', '443': 'https'}
tlp_markings = {'tlp:white': 'TLP_WHITE', 'tlp:green': 'TLP_GREEN',
'tlp:amber': 'TLP_AMBER', 'tlp:red': 'TLP_RED'}
relationshipsSpecifications = {'attack-pattern': {'vulnerability': 'targets', 'identity': 'targets',
'malware': 'uses', 'tool': 'uses'},
'campaign': {'intrusion-set': 'attributed-to', 'threat-actor': 'attributed-to',