Add hashes property to ExternalReference, more documentation for parse_observable

stix2.1
Emmanuelle Vargas-Gonzalez 2017-08-14 14:37:49 -04:00
parent 26297f9730
commit 00462eb683
2 changed files with 10 additions and 7 deletions

View File

@ -734,17 +734,19 @@ EXT_MAP = {
'network-traffic': EXT_MAP_NETWORK_TRAFFIC, 'network-traffic': EXT_MAP_NETWORK_TRAFFIC,
'process': EXT_MAP_PROCESS, 'process': EXT_MAP_PROCESS,
'user-account': EXT_MAP_USER_ACCOUNT, 'user-account': EXT_MAP_USER_ACCOUNT,
} }
def parse_observable(data, _valid_refs, allow_custom=False): def parse_observable(data, _valid_refs, allow_custom=False):
"""Deserialize a string or file-like object into a STIX Cyber Observable object. """Deserialize a string or file-like object into a STIX Cyber Observable
object.
Args: Args:
data: The STIX 2 string to be parsed. data: The STIX 2 string to be parsed.
_valid_refs: A list of object references valid for the scope of the object being parsed. _valid_refs: A list of object references valid for the scope of the
allow_custom: Whether to allow custom properties or not. Default: False. object being parsed. Use empty list if no valid refs are present.
allow_custom: Whether to allow custom properties or not.
Default: False.
Returns: Returns:
An instantiated Python STIX Cyber Observable object. An instantiated Python STIX Cyber Observable object.

View File

@ -3,9 +3,9 @@
from collections import OrderedDict from collections import OrderedDict
from .base import _STIXBase from .base import _STIXBase
from .properties import (IDProperty, ListProperty, Property, ReferenceProperty, from .properties import (IDProperty, HashesProperty, ListProperty, Property,
SelectorProperty, StringProperty, TimestampProperty, ReferenceProperty, SelectorProperty, StringProperty,
TypeProperty) TimestampProperty, TypeProperty)
from .utils import NOW, get_dict from .utils import NOW, get_dict
@ -15,6 +15,7 @@ class ExternalReference(_STIXBase):
('source_name', StringProperty(required=True)), ('source_name', StringProperty(required=True)),
('description', StringProperty()), ('description', StringProperty()),
('url', StringProperty()), ('url', StringProperty()),
('hashes', HashesProperty()),
('external_id', StringProperty()), ('external_id', StringProperty()),
]) ])