Skip to content

Commit

Permalink
Merge pull request #297 from STIXProject/next-release
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
gtback committed Aug 8, 2016
2 parents 67f1893 + 9530bca commit 40d89f0
Show file tree
Hide file tree
Showing 120 changed files with 2,424 additions and 10,186 deletions.
77 changes: 65 additions & 12 deletions docs/api/utils/nsparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,75 @@

.. module:: stix.utils.nsparser

Classes
-------

.. autoclass:: NamespaceParser
:show-inheritance:
:members:

Constants
---------

.. autodata:: XML_NAMESPACES
.. autodata:: NS_CAMPAIGN_OBJECT

.. autodata:: NS_CAPEC_OBJECT

.. autodata:: NS_CIQIDENTITY_OBJECT

.. autodata:: NS_COA_OBJECT

.. autodata:: NS_CVRF_OBJECT

.. autodata:: NS_ET_OBJECT

.. autodata:: NS_GENERICSTRUCTUREDCOA_OBJECT

.. autodata:: NS_GENERICTM_OBJECT

.. autodata:: NS_INCIDENT_OBJECT

.. autodata:: NS_INDICATOR_OBJECT

.. autodata:: NS_IOC_OBJECT

.. autodata:: NS_IOCTR_OBJECT

.. autodata:: NS_MARKING_OBJECT

.. autodata:: NS_OVALDEF_OBJECT

.. autodata:: NS_OVALVAR_OBJECT

.. autodata:: NS_REPORT_OBJECT

.. autodata:: NS_SIMPLEMARKING_OBJECT

.. autodata:: NS_SNORTTM_OBJECT

.. autodata:: NS_STIX_OBJECT

.. autodata:: NS_STIXCAPEC_OBJECT

.. autodata:: NS_STIXCIQADDRESS_OBJECT

.. autodata:: NS_STIXCVRF_OBJECT

.. autodata:: NS_STIXMAEC_OBJECT

.. autodata:: NS_STIXOPENIOC_OBJECT

.. autodata:: NS_STIXOVAL_OBJECT

.. autodata:: NS_STIXCOMMON_OBJECT

.. autodata:: NS_STIXVOCABS_OBJECT

.. autodata:: NS_TA_OBJECT

.. autodata:: NS_TLPMARKING_OBJECT

.. autodata:: NS_TOUMARKING_OBJECT

.. autodata:: NS_TTP_OBJECT

.. autodata:: STIX_NS_TO_SCHEMALOCATION
.. autodata:: NS_XAL_OBJECT

.. autodata:: EXT_NS_TO_SCHEMALOCATION
.. autodata:: NS_XNL_OBJECT

.. autodata:: DEFAULT_STIX_NS_TO_PREFIX
.. autodata:: NS_XPIL_OBJECT

.. autodata:: DEFAULT_EXT_TO_PREFIX
.. autodata:: NS_YARATM_OBJECT
7 changes: 7 additions & 0 deletions examples/custom_vocabstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# builtin
from StringIO import StringIO

import mixbox.namespaces

# python-stix modules
from stix.core import STIXPackage
from stix.common import vocabs
Expand Down Expand Up @@ -38,6 +40,11 @@ class CustomVocab(vocabs.VocabString):
_XSI_TYPE = 'customVocabs:CustomVocab-1.0'
_ALLOWED_VALUES = ('FOO', 'BAR')

# Register the namespace of the CustomVocab
mixbox.namespaces.register_namespace(
mixbox.namespaces.Namespace(
'http://customvocabs.com/vocabs-1', 'customVocabs'))

# Register our Custom Vocabulary class so parsing and serialization works
vocabs.add_vocab(CustomVocab)

Expand Down
3 changes: 2 additions & 1 deletion examples/vuln_affected_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# python-stix
from stix.core import STIXPackage
from stix.exploit_target import ExploitTarget
from stix.exploit_target.vulnerability import Vulnerability
from stix.exploit_target.vulnerability import Vulnerability, AffectedSoftware


# Build a Product Object that characterizes our affected software
Expand All @@ -32,6 +32,7 @@
# RelatedObservable instances. This wraps our Observable in a
# RelatedObservable layer.
vuln = Vulnerability()
vuln.affected_software = AffectedSoftware()
vuln.affected_software.append(observable)

# Create the Exploit Target
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def get_version():
'test': [
'nose==1.3.0',
'tox==1.6.1',
'maec>=4.1.0.13.dev1,<4.1.1.0',
'maec>=4.1.0.13.dev4,<4.1.1.0',
],
}


install_requires = [
'lxml>=2.3',
'python-dateutil',
'cybox>=2.1.0.13.dev0,<2.1.1.0',
'mixbox>=0.0.10',
'cybox>=2.1.0.13.dev1,<2.1.1.0',
'mixbox>=0.0.13',
]


Expand Down
6 changes: 3 additions & 3 deletions stix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def _lookup_extension(xsi_type):
ValueError: If no class has been registered for the `xsi_type`.
"""
import stix.extensions.malware.maec_4_1_malware

if xsi_type in _EXTENSION_MAP:
return _EXTENSION_MAP[xsi_type]

Expand Down Expand Up @@ -86,7 +88,7 @@ def lookup_extension(typeinfo, default=None):
return default

error = "Input %s is missing xml_type attribute. Cannot lookup class."
raise ValueError(error)
raise ValueError(error % type(typeinfo))

# Extension binding classes usually (always?) have an `xmlns_prefix`
# class attribute.
Expand Down Expand Up @@ -124,11 +126,9 @@ def register_extension(cls):
add_extension(cls)
return cls


from . import common # noqa
from .version import __version__ # noqa


def supported_stix_version():
"""Returns a tuple of STIX version strings that this version of python-stix
supports (i.e., can parse).
Expand Down

0 comments on commit 40d89f0

Please sign in to comment.