STIX Document Validator
=======================
A Python tool and API that validates STIX and CybOX XML instance documents.
.. _STIX XML Schema: https://stixproject.github.io/releases/1.2/
.. _CybOX XML Schema: https://cyboxproject.github.io/releases/2.1/
.. _STIX Profiles: http://stixproject.github.io/documentation/profiles/
.. _STIX Best Practices: http://stixproject.github.io/documentation/suggested-practices/
:Source: https://github.com/STIXProject/stix-validator
:Documentation: http://stix-validator.readthedocs.org
:Information: https://stixproject.github.io | https://cyboxproject.github.io
|travis badge| |health badge| |version badge|
.. |travis badge| image:: https://api.travis-ci.org/STIXProject/stix-validator.svg?branch=master
:target: https://travis-ci.org/STIXProject/stix-validator
:alt: Build Status
.. |health badge| image:: https://landscape.io/github/STIXProject/stix-validator/master/landscape.svg?style=flat
:target: https://landscape.io/github/STIXProject/stix-validator/master
:alt: Code Health
.. |version badge| image:: https://img.shields.io/pypi/v/stix-validator.svg?maxAge=3600
:target: https://pypi.python.org/pypi/stix-validator/
:alt: PyPI Version Badge
Validation
----------
The **STIX Document Validator (sdv)** can perform the following forms of
STIX document validation:
* `STIX XML Schema`_: Validate STIX documents against bundled or external
STIX schemas.
* `STIX Profiles`_: Verify STIX Profile conformance (**experimental**)
* `STIX Best Practices`_: Verify alignment with STIX Best Practices.
The following forms of CybOX document validation are also possible:
* `CybOX XML Schema`_
Dependencies
------------
The **STIX Document Validator** has the following dependencies:
* `Python`_: Python interpreter
* `lxml`_ >= v3.2.0: XML processing library.
* `libxml2`_ >= v2.9.1: Required XML processing C
library for ``lxml``.
* `xlrd`_ >= v0.9.2: XLSX library for parsing STIX Profiles.
.. _Python: http://python.org/download
.. _lxml: http://lxml.de/index.html#download
.. _libxml2: http://www.xmlsoft.org/downloads.html
.. _xlrd: https://pypi.python.org/pypi/xlrd
For a Windows installer of lxml, we recommend looking here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
The **STIX Document Validator** supports Python 3.8+.
Installation
------------
The recommended method for installing the **STIX Document Validator** is via
``pip``.
::
$ pip install stix-validator
This will install the ``sdv`` package into your Python installation's
``site-packages`` and four scripts found under ``sdv/scripts`` on your ``PATH``.
How To Use
----------
The **STIX Document Validator** bundles four scripts: ``stix_validator.py``,
``profile_to_sch.py``, ``profile_to_xslt.py``, and ``cybox_validator.py``,
STIX Validation
"""""""""""""""
The ``stix_validator.py`` script can can validate a STIX XML document against
STIX schemas, STIX Best Practices, and STIX Profiles.
**NOTE:** The STIX Profile validation should be considered **experimental.**
**Validate using bundled schemas**
.. code-block:: bash
$ stix-validator <stix_document.xml>
**Validate using schemaLocation**
.. code-block:: bash
$ stix-validator --use-schemaloc <stix_document.xml>
**Validate using non-bundled schemas**
.. code-block:: bash
$ stix-validator --schema-dir </path/to/schemas> <stix_document.xml>
**NOTE:** If you are trying to validate a STIX document from a checked-out
copy of STIX schema repository, make sure you have also cloned the CybOX
schema submodule with ``git submodule init`` and ``git submodule update``.
**Validate a directory of STIX documents**
.. code-block:: bash
$ stix-validator </path/to/stix_dir>
**Validate multiple files and/or directories**
.. code-block:: bash
$ stix-validator <one.xml> <two.xml> <directory_of_files> ...
**Check "best practice" guidance**
.. code-block:: bash
$ stix-validator --best-practices <stix_document.xml>
**Validate using STIX Profile**
.. code-block:: bash
$ stix-validator --profile <stix_profile.xlsx> <stix_document.xml>
STIX Profile to Schematron Conversion
"""""""""""""""""""""""""""""""""""""
The ``profile_to_sch.py`` script performs a conversion from a valid STIX profile
to schematron.
.. code-block:: bash
$ profile-to-sch <valid_stix_profile.xlsx>
Schematron output is sent to stdout.
STIX Profile to XSLT Conversion
"""""""""""""""""""""""""""""""
The ``profile_to_xslt.py`` script performs a conversion from a valid STIX profile
to XSLT.
.. code-block:: bash
$ profile-to-xslt <valid_stix_profile.xlsx>
XSLT output is sent to stdout.
CybOX Validation
""""""""""""""""
The ``cybox_validator.py`` script can perform CybOX XML Schema validation.
**Validate using bundled schemas**
.. code-block:: bash
$ cybox-validator <cybox_document.xml>
**Validate using schemaLocation**
.. code-block:: bash
$ cybox-validator --use-schemaloc <cybox_document.xml>
**Validate using non-bundled schemas**
.. code-block:: bash
$ cybox-validator --schema-dir </path/to/schemas> <cybox_document.xml>
**Validate a directory of CybOX documents**
.. code-block:: bash
$ cybox-validator </path/to/cybox_dir>
**Validate multiple files and/or directories**
.. code-block:: bash
$ cybox-validator <one.xml> <two.xml> <directory_of_files> ...
All STIX and CybOX Documents?
-----------------------------
The **STIX Document Validator** bundles XML schemas with it, which
includes all STIX (v1.0 through v1.2.1) and CybOX (2.0 through v2.1) schema
files. If a document includes instances of schematic constructs defined
outside of the STIX or CybOX languages, a user must point the
**STIX Document Validator** scripts at those schemas in order to validate.
To use schemas other than those bundled with the **STIX Document Validator**
use the ``--schemas-dir`` flag to pass in a path to a schema directory.
Common Libxml2 Error
--------------------
Users often report an error which looks something like the following:
::
Fatal error occurred: local union type: A type, derived by list or union, must have the
simple ur-type definition as base type, not '{http://cybox.mitre.org/common-2}(NULL)'., line 350
This error is caused by an insufficient version of libxml2 being installed
on the system. The **STIX Document Validator** requires ``libxml2`` v2.9.1 at
a minimum and is not guaranteed to work properly with earlier versions.
To see what version of libxml2 you have installed, execute the
``xml2-config --version`` command and make sure you are running at least v2.9.1.
Terms
-----
BY USING THE STIX DOCUMENT VALIDATOR, YOU SIGNIFY YOUR ACCEPTANCE OF THE
TERMS AND CONDITIONS OF USE. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE
THE STIX DOCUMENT VALIDATOR.
For more information, please refer to the LICENSE.txt file
Raw data
{
"_id": null,
"home_page": "http://stix.mitre.org/",
"name": "stix-validator",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "stix cybox xml validation validator stix-validator",
"author": "The MITRE Corporation",
"author_email": "stix@mitre.org",
"download_url": "https://files.pythonhosted.org/packages/da/3b/4e6e41c1298a9a211f41e978dfad96f0a7569ab14e4b25f1f980daa62a7a/stix-validator-3.0.0.tar.gz",
"platform": null,
"description": "STIX Document Validator\n=======================\n\nA Python tool and API that validates STIX and CybOX XML instance documents.\n\n.. _STIX XML Schema: https://stixproject.github.io/releases/1.2/\n.. _CybOX XML Schema: https://cyboxproject.github.io/releases/2.1/\n.. _STIX Profiles: http://stixproject.github.io/documentation/profiles/\n.. _STIX Best Practices: http://stixproject.github.io/documentation/suggested-practices/\n\n:Source: https://github.com/STIXProject/stix-validator\n:Documentation: http://stix-validator.readthedocs.org\n:Information: https://stixproject.github.io | https://cyboxproject.github.io\n\n|travis badge| |health badge| |version badge|\n\n.. |travis badge| image:: https://api.travis-ci.org/STIXProject/stix-validator.svg?branch=master\n :target: https://travis-ci.org/STIXProject/stix-validator\n :alt: Build Status\n.. |health badge| image:: https://landscape.io/github/STIXProject/stix-validator/master/landscape.svg?style=flat\n :target: https://landscape.io/github/STIXProject/stix-validator/master\n :alt: Code Health\n.. |version badge| image:: https://img.shields.io/pypi/v/stix-validator.svg?maxAge=3600\n :target: https://pypi.python.org/pypi/stix-validator/\n :alt: PyPI Version Badge\n\nValidation\n----------\n\nThe **STIX Document Validator (sdv)** can perform the following forms of\nSTIX document validation:\n\n* `STIX XML Schema`_: Validate STIX documents against bundled or external\n STIX schemas.\n* `STIX Profiles`_: Verify STIX Profile conformance (**experimental**)\n* `STIX Best Practices`_: Verify alignment with STIX Best Practices.\n\nThe following forms of CybOX document validation are also possible:\n\n* `CybOX XML Schema`_\n\nDependencies\n------------\n\nThe **STIX Document Validator** has the following dependencies:\n\n* `Python`_: Python interpreter\n* `lxml`_ >= v3.2.0: XML processing library.\n\n * `libxml2`_ >= v2.9.1: Required XML processing C \n library for ``lxml``.\n* `xlrd`_ >= v0.9.2: XLSX library for parsing STIX Profiles.\n\n.. _Python: http://python.org/download\n.. _lxml: http://lxml.de/index.html#download\n.. _libxml2: http://www.xmlsoft.org/downloads.html\n.. _xlrd: https://pypi.python.org/pypi/xlrd\n\nFor a Windows installer of lxml, we recommend looking here: \nhttp://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml\n\nThe **STIX Document Validator** supports Python 3.8+.\n\n\nInstallation\n------------\n\nThe recommended method for installing the **STIX Document Validator** is via\n``pip``.\n\n::\n\n $ pip install stix-validator\n\nThis will install the ``sdv`` package into your Python installation's\n``site-packages`` and four scripts found under ``sdv/scripts`` on your ``PATH``.\n\n\nHow To Use\n----------\n\nThe **STIX Document Validator** bundles four scripts: ``stix_validator.py``,\n``profile_to_sch.py``, ``profile_to_xslt.py``, and ``cybox_validator.py``,\n\nSTIX Validation\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe ``stix_validator.py`` script can can validate a STIX XML document against\nSTIX schemas, STIX Best Practices, and STIX Profiles.\n\n**NOTE:** The STIX Profile validation should be considered **experimental.**\n\n**Validate using bundled schemas**\n\n.. code-block:: bash\n\n $ stix-validator <stix_document.xml>\n\n**Validate using schemaLocation** \n\n.. code-block:: bash\n\n $ stix-validator --use-schemaloc <stix_document.xml>\n\n**Validate using non-bundled schemas**\n\n.. code-block:: bash\n\n $ stix-validator --schema-dir </path/to/schemas> <stix_document.xml>\n\n**NOTE:** If you are trying to validate a STIX document from a checked-out\ncopy of STIX schema repository, make sure you have also cloned the CybOX \nschema submodule with ``git submodule init`` and ``git submodule update``.\n\n**Validate a directory of STIX documents** \n\n.. code-block:: bash\n\n $ stix-validator </path/to/stix_dir>\n\n**Validate multiple files and/or directories** \n\n.. code-block:: bash\n\n $ stix-validator <one.xml> <two.xml> <directory_of_files> ...\n\n**Check \"best practice\" guidance** \n\n.. code-block:: bash\n\n $ stix-validator --best-practices <stix_document.xml>\n\n**Validate using STIX Profile** \n\n.. code-block:: bash\n\n $ stix-validator --profile <stix_profile.xlsx> <stix_document.xml>\n\n\nSTIX Profile to Schematron Conversion\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe ``profile_to_sch.py`` script performs a conversion from a valid STIX profile\nto schematron.\n\n.. code-block:: bash\n\n $ profile-to-sch <valid_stix_profile.xlsx>\n\nSchematron output is sent to stdout.\n\nSTIX Profile to XSLT Conversion\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe ``profile_to_xslt.py`` script performs a conversion from a valid STIX profile\nto XSLT.\n\n.. code-block:: bash\n\n $ profile-to-xslt <valid_stix_profile.xlsx>\n\nXSLT output is sent to stdout.\n\nCybOX Validation\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe ``cybox_validator.py`` script can perform CybOX XML Schema validation.\n\n**Validate using bundled schemas**\n\n.. code-block:: bash\n\n $ cybox-validator <cybox_document.xml>\n\n**Validate using schemaLocation**\n\n.. code-block:: bash\n\n $ cybox-validator --use-schemaloc <cybox_document.xml>\n\n**Validate using non-bundled schemas**\n\n.. code-block:: bash\n\n $ cybox-validator --schema-dir </path/to/schemas> <cybox_document.xml>\n\n**Validate a directory of CybOX documents**\n\n.. code-block:: bash\n\n $ cybox-validator </path/to/cybox_dir>\n\n**Validate multiple files and/or directories**\n\n.. code-block:: bash\n\n $ cybox-validator <one.xml> <two.xml> <directory_of_files> ...\n\n\nAll STIX and CybOX Documents?\n-----------------------------\n\nThe **STIX Document Validator** bundles XML schemas with it, which\nincludes all STIX (v1.0 through v1.2.1) and CybOX (2.0 through v2.1) schema\nfiles. If a document includes instances of schematic constructs defined\noutside of the STIX or CybOX languages, a user must point the\n**STIX Document Validator** scripts at those schemas in order to validate.\n\nTo use schemas other than those bundled with the **STIX Document Validator**\nuse the ``--schemas-dir`` flag to pass in a path to a schema directory.\n\nCommon Libxml2 Error\n--------------------\n\nUsers often report an error which looks something like the following:\n\n::\n\n Fatal error occurred: local union type: A type, derived by list or union, must have the\n simple ur-type definition as base type, not '{http://cybox.mitre.org/common-2}(NULL)'., line 350\n\nThis error is caused by an insufficient version of libxml2 being installed\non the system. The **STIX Document Validator** requires ``libxml2`` v2.9.1 at\na minimum and is not guaranteed to work properly with earlier versions.\n\nTo see what version of libxml2 you have installed, execute the\n``xml2-config --version`` command and make sure you are running at least v2.9.1.\n\nTerms\n-----\n\nBY USING THE STIX DOCUMENT VALIDATOR, YOU SIGNIFY YOUR ACCEPTANCE OF THE \nTERMS AND CONDITIONS OF USE. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE \nTHE STIX DOCUMENT VALIDATOR.\n\nFor more information, please refer to the LICENSE.txt file\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "APIs and scripts for validating STIX and CybOX documents.",
"version": "3.0.0",
"project_urls": {
"Homepage": "http://stix.mitre.org/"
},
"split_keywords": [
"stix",
"cybox",
"xml",
"validation",
"validator",
"stix-validator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb70c6120e1d3b9a1e2a3185be2adb1247f8ed3a96ae5ab4dbac1a8e3926dafa",
"md5": "a6f15f44ef42d8e3160eaaa5be05392a",
"sha256": "224885f8bfa410060425798b86584521a32089e5366540d74bd6e02c5f0b07ce"
},
"downloads": -1,
"filename": "stix_validator-3.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "a6f15f44ef42d8e3160eaaa5be05392a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 3399114,
"upload_time": "2024-02-16T20:08:10",
"upload_time_iso_8601": "2024-02-16T20:08:10.126135Z",
"url": "https://files.pythonhosted.org/packages/bb/70/c6120e1d3b9a1e2a3185be2adb1247f8ed3a96ae5ab4dbac1a8e3926dafa/stix_validator-3.0.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "da3b4e6e41c1298a9a211f41e978dfad96f0a7569ab14e4b25f1f980daa62a7a",
"md5": "8887fbf1b702687f4c15c473dc669833",
"sha256": "4c9c04e708e6b27bd2469e680dea0cc41ae0cd776066d9daf6cbd8b17c17718b"
},
"downloads": -1,
"filename": "stix-validator-3.0.0.tar.gz",
"has_sig": false,
"md5_digest": "8887fbf1b702687f4c15c473dc669833",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2409130,
"upload_time": "2024-02-16T20:08:12",
"upload_time_iso_8601": "2024-02-16T20:08:12.749611Z",
"url": "https://files.pythonhosted.org/packages/da/3b/4e6e41c1298a9a211f41e978dfad96f0a7569ab14e4b25f1f980daa62a7a/stix-validator-3.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-16 20:08:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "stix-validator"
}