stix2-patterns 2.1.2
Validate STIX 2 Patterns.
Requires Python: >=3.10

cti-pattern-validator
=====================

This is an `OASIS TC Open Repository
<https://www.oasis-open.org/resources/open-repositories/>`__. See the
`Governance <#governance>`__ section for more information.

The STIX 2 Pattern Validator is a software tool for checking the syntax of the
Cyber Threat Intelligence (CTI) STIX Pattern expressions, which are used within
STIX to express conditions (prepresented with the Cyber Observable data model)
that indicate particular cyber threat activity. The repository contains source
code, an ANTLR grammar, automated tests and associated documentation for the
tool. The validator can be used as a command-line tool or as a Python library
which can be included in other applications.

|Build_Status| |Coverage| |Version| |Scorecard|

Quickstart
----------

1. Install with pip:

   .. code-block:: bash

        $ pip install stix2-patterns

2. Validate a pattern from the command line:

   .. code-block:: bash

        $ validate-patterns
        Enter a pattern to validate: [file-object:hashes.md5 = '79054025255fb1a26e4bc422aef54eb4']
        PASS: [file-object:hashes.md5 = '79054025255fb1a26e4bc422aef54eb4']

3. Validate a pattern from Python code:

   .. code:: python

        from stix2patterns.validator import run_validator

        pattern = "[file-object:hashes.md5 = '79054025255fb1a26e4bc422aef54eb4']"
        errors = run_validator(pattern)

For more information, see the `stix2-patterns documentation <https://stix2-patterns.readthedocs.io/>`_

Governance
----------

This GitHub public repository
(**https://github.com/oasis-open/cti-pattern-validator** ) was `proposed
<https://lists.oasis- open.org/archives/cti/201609/msg00001.html>`__ and
`approved <https://www.oasis-open.org/committees/ballot.php?id=2971>`__ [`bis
<https://issues.oasis-open.org/browse/TCADMIN-2431>`__\ ] by the `OASIS Cyber
Threat Intelligence (CTI) TC <https://www.oasis-open.org/committees/cti/>`__ as
an `OASIS TC Open Repository
<https://www.oasis-open.org/resources/open-repositories/>`__ to support
development of open source resources related to Technical Committee work.

While this TC Open Repository remains associated with the sponsor TC, its
development priorities, leadership, intellectual property terms, participation
rules, and other matters of governance are `separate and distinct
<https://github.com/oasis-open/cti-pattern-validator/blob/master/CONTRIBUTING.md#governance-distinct-from-oasis-tc-process>`__
from the OASIS TC Process and related policies.

All contributions made to this TC Open Repository are subject to open source
license terms expressed in the `BSD-3-Clause License
<https://www.oasis-open.org/sites/www.oasis-open.org/files/BSD-3-Clause.txt>`__.
That license was selected as the declared `"Applicable License"
<https://www.oasis-open.org/resources/open-repositories/licenses>`__ when the TC
Open Repository was created.

As documented in `"Public Participation Invited
<https://github.com/oasis-open/cti-pattern-validator/blob/master/CONTRIBUTING.md#public-participation-invited>`__",
contributions to this OASIS TC Open Repository are invited from all parties,
whether affiliated with OASIS or not. Participants must have a GitHub account,
but no fees or OASIS membership obligations are required. Participation is
expected to be consistent with the `OASIS TC Open Repository Guidelines and
Procedures
<https://www.oasis-open.org/policies-guidelines/open-repositories>`__,
the open source `LICENSE
<https://github.com/oasis-open/cti-pattern-validator/blob/master/LICENSE>`__
designated for this particular repository, and the requirement for an
`Individual Contributor License Agreement
<https://www.oasis-open.org/resources/open-repositories/cla/individual-cla>`__
that governs intellectual property.

Maintainers
~~~~~~~~~~~

TC Open Repository `Maintainers
<https://www.oasis-open.org/resources/open-repositories/maintainers-guide>`__
are responsible for oversight of this project's community development
activities, including evaluation of GitHub `pull requests
<https://github.com/oasis-open/cti-pattern-validator/blob/master/CONTRIBUTING.md#fork-and-pull-collaboration-model>`__
and `preserving
<https://www.oasis-open.org/policies-guidelines/open-repositories#repositoryManagement>`__
open source principles of openness and fairness. Maintainers are recognized and
trusted experts who serve to implement community goals and consensus design
preferences.

Initially, the associated TC members have designated one or more persons to
serve as Maintainer(s); subsequently, participating community members may select
additional or substitute Maintainers, per `consensus agreements
<https://www.oasis-open.org/resources/open-repositories/maintainers-guide#additionalMaintainers>`__.

.. _currentMaintainers:

Current Maintainers of this TC Open Repository
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-  `Emily Ratliff <mailto:Emily.Ratliff@ibm.com>`__; GitHub ID:
   https://github.com/ejratl; WWW: `IBM <http://www.ibm.com/>`__
-  `Alexandre Dulaunoy <mailto:alexandre.dulaunoy@circl.lu>`__; GitHub ID:
   https://github.com/adulau; WWW: `CIRCL <http://www.circl.lu/>`__
-  `Christian Studer <mailto:christian.studer@circl.lu>`__; GitHub ID:
   https://github.com/chrisr3d; WWW: `CIRCL <http://www.circl.lu/>`__

About OASIS TC Open Repositories
--------------------------------

-  `TC Open Repositories: Overview and Resources
   <https://www.oasis-open.org/resources/open-repositories/>`_
-  `Frequently Asked Questions
   <https://www.oasis-open.org/resources/open-repositories/faq>`_
-  `Open Source Licenses
   <https://www.oasis-open.org/resources/open-repositories/licenses>`_
-  `Contributor License Agreements (CLAs)
   <https://www.oasis-open.org/resources/open-repositories/cla>`_
-  `Maintainers' Guidelines and Agreement
   <https://www.oasis-open.org/resources/open-repositories/maintainers-guide>`_

Feedback
--------

Questions or comments about this TC Open Repository's activities should be
composed as GitHub issues or comments. If use of an issue/comment is not
possible or appropriate, questions may be directed by email to the Maintainer(s)
`listed above <#currentmaintainers>`__. Please send general questions about TC
Open Repository participation to OASIS Staff at repository-admin@oasis-open.org
and any specific CLA-related questions to repository-cla@oasis-open.org.

.. |Build_Status| image:: https://github.com/oasis-open/cti-pattern-validator/workflows/cti-pattern-validator%20test%20harness/badge.svg
   :target: https://github.com/oasis-open/cti-pattern-validator/actions?query=workflow%3A%22cti-pattern-validator+test+harness%22
.. |Coverage| image:: https://codecov.io/gh/oasis-open/cti-pattern-validator/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/oasis-open/cti-pattern-validator
.. |Version| image:: https://img.shields.io/pypi/v/stix2-patterns.svg?maxAge=3600
   :target: https://pypi.org/project/stix2-patterns/
.. |Scorecard| image:: https://api.securityscorecards.dev/projects/github.com/oasis-open/cti-pattern-validator/badge
     :target: https://api.securityscorecards.dev/projects/github.com/oasis-open/cti-pattern-validator