parent
fe4c4d78fc
commit
cd815bfe84
2
setup.py
2
setup.py
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
install_requires = [
|
||||
'pytz',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""STIX 2 Bundle object"""
|
||||
|
||||
from .base import _STIXBase
|
||||
from .properties import IDProperty, TypeProperty, Property
|
||||
from .properties import IDProperty, Property, TypeProperty
|
||||
|
||||
|
||||
class Bundle(_STIXBase):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""STIX 2 Common Data Types and Properties"""
|
||||
|
||||
from .properties import (ListProperty, BooleanProperty,
|
||||
ReferenceProperty, TimestampProperty)
|
||||
from .other import ExternalReference, GranularMarking
|
||||
from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
|
||||
TimestampProperty)
|
||||
from .utils import NOW
|
||||
|
||||
COMMON_PROPERTIES = {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""STIX 2.0 Objects that are neither SDOs nor SROs"""
|
||||
|
||||
from .base import _STIXBase
|
||||
from .properties import (IDProperty, TypeProperty, ListProperty, TimestampProperty,
|
||||
ReferenceProperty, Property, SelectorProperty,
|
||||
StringProperty)
|
||||
from .utils import NOW, get_dict
|
||||
from .properties import (IDProperty, ListProperty, Property, ReferenceProperty,
|
||||
SelectorProperty, StringProperty, TimestampProperty,
|
||||
TypeProperty)
|
||||
from .utils import get_dict, NOW
|
||||
|
||||
|
||||
class ExternalReference(_STIXBase):
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import collections
|
||||
import datetime as dt
|
||||
import inspect
|
||||
import re
|
||||
import uuid
|
||||
from six import text_type
|
||||
import datetime as dt
|
||||
import pytz
|
||||
|
||||
from dateutil import parser
|
||||
import inspect
|
||||
import collections
|
||||
import pytz
|
||||
from six import text_type
|
||||
|
||||
from .base import _STIXBase
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
from .base import _STIXBase
|
||||
from .common import COMMON_PROPERTIES
|
||||
from .other import KillChainPhase
|
||||
from .properties import (Property, ListProperty, StringProperty, TypeProperty,
|
||||
IDProperty, TimestampProperty, ReferenceProperty,
|
||||
IntegerProperty)
|
||||
from .properties import (IDProperty, IntegerProperty, ListProperty, Property,
|
||||
ReferenceProperty, StringProperty, TimestampProperty,
|
||||
TypeProperty)
|
||||
from .utils import NOW
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
from .base import _STIXBase
|
||||
from .common import COMMON_PROPERTIES
|
||||
from .properties import (ListProperty, StringProperty, TypeProperty,
|
||||
IDProperty, TimestampProperty, ReferenceProperty,
|
||||
IntegerProperty)
|
||||
from .properties import (IDProperty, IntegerProperty, ListProperty,
|
||||
ReferenceProperty, StringProperty, TimestampProperty,
|
||||
TypeProperty)
|
||||
|
||||
|
||||
class Relationship(_STIXBase):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import ATTACK_PATTERN_ID
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import CAMPAIGN_ID
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import COURSE_OF_ACTION_ID
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Tests for stix.ExternalReference"""
|
||||
|
||||
import pytest
|
||||
import re
|
||||
|
||||
import pytest
|
||||
import stix2
|
||||
|
||||
VERIS = """{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import IDENTITY_ID
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import datetime as dt
|
||||
import re
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import re
|
||||
|
||||
import stix2
|
||||
|
||||
from .constants import FAKE_TIME, INDICATOR_ID, INDICATOR_KWARGS
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import INTRUSION_SET_ID
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import datetime as dt
|
||||
import re
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import re
|
||||
|
||||
import stix2
|
||||
|
||||
from .constants import FAKE_TIME, MALWARE_ID, MALWARE_KWARGS
|
||||
|
@ -148,3 +147,16 @@ def test_parse_malware_kill_chain_phases():
|
|||
assert mal.kill_chain_phases[0].phase_name == "reconnaissance"
|
||||
assert mal['kill_chain_phases'][0]['kill_chain_name'] == "lockheed-martin-cyber-kill-chain"
|
||||
assert mal['kill_chain_phases'][0]['phase_name'] == "reconnaissance"
|
||||
|
||||
|
||||
def test_parse_malware_clean_kill_chain_phases():
|
||||
kill_chain = """
|
||||
"kill_chain_phases": [
|
||||
{
|
||||
"kill_chain_name": "lockheed-martin-cyber-kill-chain",
|
||||
"phase_name": 1
|
||||
}
|
||||
]"""
|
||||
data = EXPECTED_MALWARE.replace('malware"', 'malware",%s' % kill_chain)
|
||||
mal = stix2.parse(data)
|
||||
assert mal['kill_chain_phases'][0]['phase_name'] == "1"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import stix2
|
||||
from stix2.other import TLP_WHITE
|
||||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
from stix2.other import TLP_WHITE
|
||||
|
||||
from .constants import MARKING_DEFINITION_ID
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import OBSERVED_DATA_ID
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import pytest
|
||||
|
||||
from stix2.properties import (Property, BooleanProperty, ListProperty,
|
||||
StringProperty, TypeProperty, IDProperty,
|
||||
IntegerProperty, ReferenceProperty,
|
||||
TimestampProperty)
|
||||
from stix2.properties import (BooleanProperty, IDProperty, IntegerProperty,
|
||||
ListProperty, Property, ReferenceProperty,
|
||||
StringProperty, TimestampProperty, TypeProperty)
|
||||
from .constants import FAKE_TIME
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import stix2
|
||||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import INDICATOR_KWARGS, REPORT_ID
|
||||
|
||||
EXPECTED = """{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import THREAT_ACTOR_ID
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import TOOL_ID
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import datetime as dt
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
import datetime as dt
|
||||
import stix2
|
||||
|
||||
from .constants import VULNERABILITY_ID
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
"""Utility functions and classes for the stix2 library."""
|
||||
|
||||
import datetime as dt
|
||||
import pytz
|
||||
import json
|
||||
|
||||
import pytz
|
||||
|
||||
# Sentinel value for fields that should be set to the current time.
|
||||
# We can't use the standard 'default' approach, since if there are multiple
|
||||
# timestamps in a single object, the timestamps will vary by a few microseconds.
|
||||
|
|
Loading…
Reference in New Issue