Minor changes

stix2.1
Emmanuelle Vargas-Gonzalez 2017-10-23 08:04:18 -04:00
parent be3e841ecb
commit ef98c38937
5 changed files with 12 additions and 6 deletions

View File

@ -22,7 +22,8 @@
from . import exceptions
from .common import (TLP_AMBER, TLP_GREEN, TLP_RED, TLP_WHITE, CustomMarking,
ExternalReference, GranularMarking, KillChainPhase,
MarkingDefinition, StatementMarking, TLPMarking)
LanguageContent, MarkingDefinition, StatementMarking,
TLPMarking)
from .core import Bundle, _register_type, parse
from .environment import Environment, ObjectFactory
from .markings import (add_markings, clear_markings, get_markings, is_marked,

View File

@ -41,7 +41,7 @@ class GranularMarking(_STIXBase):
_properties = OrderedDict()
_properties.update([
('lang', StringProperty()),
('marking_ref', ReferenceProperty(type="marking-definition")), # TODO: In 2.0 is required, not in 2.1
('marking_ref', ReferenceProperty(type="marking-definition")),
('selectors', ListProperty(SelectorProperty, required=True)),
])
@ -51,6 +51,7 @@ class GranularMarking(_STIXBase):
class LanguageContent(_STIXBase):
_type = 'language-content'
_properties = OrderedDict()
_properties.update([
@ -61,7 +62,7 @@ class LanguageContent(_STIXBase):
('modified', TimestampProperty(default=lambda: NOW, precision='millisecond')),
('object_ref', ReferenceProperty(required=True)),
# TODO: 'object_modified' it MUST be an exact match for the modified time of the STIX Object (SRO or SDO) being referenced.
('object_modified', TimestampProperty(required=True)),
('object_modified', TimestampProperty(required=True, precision='millisecond')),
# TODO: 'contents' https://docs.google.com/document/d/1ShNq4c3e1CkfANmD9O--mdZ5H0O_GLnjN28a_yrEaco/edit#heading=h.cfz5hcantmvx
('contents', DictionaryProperty(required=True)),
('revoked', BooleanProperty()),

View File

@ -460,7 +460,7 @@ class SocketExt(_Extension):
"SOCK_SEQPACKET",
])),
('socket_descriptor', IntegerProperty()),
('socket_handle', IntegerProperty())
('socket_handle', IntegerProperty()),
])

View File

@ -281,7 +281,7 @@ class Opinion(STIXDomainObject):
('created_by_ref', ReferenceProperty(type="identity")),
('created', TimestampProperty(default=lambda: NOW, precision='millisecond')),
('modified', TimestampProperty(default=lambda: NOW, precision='millisecond')),
('description', StringProperty),
('description', StringProperty()),
('authors', ListProperty(StringProperty)),
('object_refs', ListProperty(ReferenceProperty, required=True)),
('opinion', EnumProperty(allowed=[

View File

@ -87,7 +87,7 @@ def format_datetime(dttm):
ms = zoned.strftime("%f")
precision = getattr(dttm, "precision", None)
if precision == 'second':
pass # Alredy precise to the second
pass # Already precise to the second
elif precision == "millisecond":
ts = ts + '.' + ms[:3]
elif zoned.microsecond > 0:
@ -191,6 +191,10 @@ def find_property_index(obj, properties, tuple_to_find):
tuple_to_find)
if val is not None:
return val
elif isinstance(item, dict) and tuple_to_find[0] in item:
for num, t in enumerate(item.keys(), start=1):
if t == tuple_to_find[0]:
return num
def new_version(data, **kwargs):