From fb75de47c507caaf8fe5892a6a9f5109bfbd585c Mon Sep 17 00:00:00 2001 From: Richard Piazza Date: Thu, 17 Aug 2017 14:50:42 -0400 Subject: [PATCH] added TimestampConstant --- stix2/__init__.py | 3 ++- stix2/patterns.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/stix2/__init__.py b/stix2/__init__.py index 98697a9..503194c 100644 --- a/stix2/__init__.py +++ b/stix2/__init__.py @@ -37,7 +37,7 @@ from .patterns import (AndBooleanExpression, AndObservationExpression, OrObservationExpression, ParentheticalExpression, QualifiedObservationExpression, ReferenceObjectPathComponent, RepeatQualifier, - StartStopQualifier, StringConstant, WithinQualifier) + StartStopQualifier, StringConstant, TimestampConstant, WithinQualifier) from .sdo import (AttackPattern, Campaign, CourseOfAction, CustomObject, Identity, Indicator, IntrusionSet, Malware, ObservedData, Report, ThreatActor, Tool, Vulnerability) @@ -47,6 +47,7 @@ from .version import __version__ OBJ_MAP = { 'attack-pattern': AttackPattern, + 'bundle': Bundle, 'campaign': Campaign, 'course-of-action': CourseOfAction, 'identity': Identity, diff --git a/stix2/patterns.py b/stix2/patterns.py index d861144..8f0b8c7 100644 --- a/stix2/patterns.py +++ b/stix2/patterns.py @@ -19,6 +19,15 @@ class StringConstant(_Constant): return "'%s'" % escape_quotes_and_backslashes(self.value) +class TimestampConstant(_Constant): + def __init__(self, value): + self.value = value + + def __str__(self): + return "'%s'" % escape_quotes_and_backslashes(self.value) + + + class IntegerConstant(_Constant): def __init__(self, value): try: