import issues
parent
3384507405
commit
5280c60c74
|
@ -8,7 +8,22 @@ from stix2patterns.validator import STIXPatternErrorListener
|
||||||
import importlib
|
import importlib
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
from .patterns import *
|
from .patterns import (FollowedByObservationExpression,
|
||||||
|
IsSubsetComparisonExpression,
|
||||||
|
IsSupersetComparisonExpression,
|
||||||
|
StartStopQualifier,
|
||||||
|
WithinQualifier,
|
||||||
|
RepeatQualifier,
|
||||||
|
BasicObjectPathComponent,
|
||||||
|
StringConstant,
|
||||||
|
IntegerConstant,
|
||||||
|
FloatConstant,
|
||||||
|
HexConstant,
|
||||||
|
BinaryConstant,
|
||||||
|
BooleanConstant,
|
||||||
|
TimestampConstant
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def collapse_lists(lists):
|
def collapse_lists(lists):
|
||||||
result = []
|
result = []
|
||||||
|
@ -19,6 +34,7 @@ def collapse_lists(lists):
|
||||||
result.append(c)
|
result.append(c)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def quote_if_needed(x):
|
def quote_if_needed(x):
|
||||||
if x.find("-") != -1:
|
if x.find("-") != -1:
|
||||||
return "'" + x + "'"
|
return "'" + x + "'"
|
||||||
|
|
|
@ -12,6 +12,7 @@ from .utils import parse_into_datetime
|
||||||
def escape_quotes_and_backslashes(s):
|
def escape_quotes_and_backslashes(s):
|
||||||
return s.replace(u'\\', u'\\\\').replace(u"'", u"\\'")
|
return s.replace(u'\\', u'\\\\').replace(u"'", u"\\'")
|
||||||
|
|
||||||
|
|
||||||
class _Constant(object):
|
class _Constant(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import pytest
|
||||||
import stix2
|
import stix2
|
||||||
|
|
||||||
def test_create_comparison_expression():
|
def test_create_comparison_expression():
|
||||||
|
|
||||||
exp = stix2.EqualityComparisonExpression("file:hashes.'SHA-256'",
|
exp = stix2.EqualityComparisonExpression("file:hashes.'SHA-256'",
|
||||||
stix2.HashConstant("aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f", "SHA-256")) # noqa
|
stix2.HashConstant("aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f", "SHA-256")) # noqa
|
||||||
|
|
||||||
|
@ -381,5 +380,3 @@ def test_make_constant_already_a_constant():
|
||||||
def test_parsing_expression():
|
def test_parsing_expression():
|
||||||
patt_obj = stix2.create_pattern_object("[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']")
|
patt_obj = stix2.create_pattern_object("[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']")
|
||||||
assert str(patt_obj) == "[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']"
|
assert str(patt_obj) == "[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue