• Stars
    star
    368
  • Rank 115,958 (Top 3 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 8 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OASIS TC Open Repository: Python APIs for STIX 2

Build Status Coverage Version Downloads Documentation Status

cti-python-stix2

This is an OASIS TC Open Repository. See the Governance section for more information.

This repository provides Python APIs for serializing and de-serializing STIX2 JSON content, along with higher-level APIs for common tasks, including data markings, versioning, and for resolving STIX IDs across multiple data sources.

For more information, see the documentation on ReadTheDocs.

Installation

Install with pip:

$ pip install stix2

Note: The library requires Python 3.6+.

Usage

To create a STIX object, provide keyword arguments to the type's constructor. Certain required attributes of all objects, such as type or id, will be set automatically if not provided as keyword arguments.

from stix2 import Indicator

indicator = Indicator(name="File hash for malware variant",
                      indicator_types=["malicious-activity"],
                      pattern_type="stix",
                      pattern="[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']")

To parse a STIX JSON string into a Python STIX object, use parse(). To serialize a STIX object, use serialize():

from stix2 import parse

indicator = parse("""{
    "type": "indicator",
    "spec_version": "2.1",
    "id": "indicator--dbcbd659-c927-4f9a-994f-0a2632274394",
    "created": "2017-09-26T23:33:39.829Z",
    "modified": "2017-09-26T23:33:39.829Z",
    "name": "File hash for malware variant",
    "indicator_types": [
        "malicious-activity"
    ],
    "pattern_type": "stix",
    "pattern_version": "2.1",
    "pattern": "[file:hashes.md5 ='d41d8cd98f00b204e9800998ecf8427e']",
    "valid_from": "2017-09-26T23:33:39.829952Z"
}""")

print(indicator.serialize(pretty=True))

For more in-depth documentation, please see https://stix2.readthedocs.io/.

STIX 2 Technical Specification Support

This version of cti-python-stix2 brings support to STIX Version 2.1 published on 10 June 2021 currently at the Committee Specification (CS) 03 level, also know as the "OASIS Standard".

The stix2 Python library supports multiple versions of the STIX 2 Technical Specification. The library will be updated to support new Committee Specification Drafts (CSDs) as they are released, but modules for these versions must be imported manually until the CSD reaches CS level. In new major releases of stix2 the import stix2 implicit import statement will be updated to automatically load the STIX Objects equivalent to the most recently supported CS. Please see the library documentation for details.

Governance

This GitHub public repository (https://github.com/oasis-open/cti-python-stix2) was proposed and approved [bis] by the OASIS Cyber Threat Intelligence (CTI) TC as an OASIS TC Open Repository 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 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. That license was selected as the declared "Applicable License" when the TC Open Repository was created.

As documented in "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, the open source LICENSE designated for this particular repository, and the requirement for an Individual Contributor License Agreement that governs intellectual property.

Maintainers

TC Open Repository Maintainers are responsible for oversight of this project's community development activities, including evaluation of GitHub pull requests and preserving 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.

Current Maintainers of this TC Open Repository

About OASIS TC Open Repositories

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. Please send general questions about TC Open Repository participation to OASIS Staff at [email protected] and any specific CLA-related questions to [email protected].

More Repositories

1

cti-stix-visualization

OASIS TC Open Repository: Lightweight visualization for STIX 2.0 objects and relationships
JavaScript
138
star
2

cti-taxii-server

OASIS TC Open Repository: TAXII 2 Server Library Written in Python
Python
121
star
3

cti-taxii-client

OASIS TC Open Repository: TAXII 2 Client Library Written in Python
Python
110
star
4

cti-stix2-json-schemas

OASIS TC Open Repository: Non-normative schemas and examples for STIX 2
ANTLR
109
star
5

cti-documentation

OASIS TC Open Repository: GitHub Pages site for STIX and TAXII
SCSS
93
star
6

cti-stix-common-objects

OASIS Cyber Threat Intelligence (CTI) TC: A repository for commonly used STIX objects in order to avoid needless duplication. https://github.com/oasis-open/cti-stix-common-objects
80
star
7

legaldocml-akomantoso

OASIS TC Open Repository: Schema files, examples, exemplificative implementations and libraries, and documentation related to the LegalDocML TC and Akoma Ntoso schema
60
star
8

cti-stix-validator

OASIS TC Open Repository: Validator for STIX 2.0 JSON normative requirements and best practices
Python
50
star
9

cti-stix-elevator

OASIS Cyber Threat Intelligence (CTI) TC Open Repository: Convert STIX 1.2 XML to STIX 2.x JSON
Python
49
star
10

cti-training

OASIS TC Open Repository: Providing a collection of CTI-related training materials
47
star
11

cti-pattern-matcher

OASIS TC Open Repository: Match STIX content against STIX patterns
Python
43
star
12

cti-stix-generator

OASIS Cyber Threat Intelligence (CTI) TC: A tool for generating STIX content for prototyping and testing. https://github.com/oasis-open/cti-stix-generator
Python
37
star
13

tosca-community-contributions

OASIS TC Open Repository: Manages TOSCA profiles, tests, and templates that are maintained by the TOSCA community. They are intended to be used as examples to help developers get started with TOSCA and to test compliance of TOSCA implementations with the standard.
Shell
37
star
14

cti-pattern-validator

OASIS TC Open Repository: Validate patterns used to express cyber observable content in STIX Indicators
Python
26
star
15

csaf-parser

OASIS TC Open Repository: CSAF Parser tool for parsing and checking the syntax of the Common Vulnerability Reporting Framework (CVRF) content
Python
23
star
16

cti-stix-slider

OASIS TC Open Repository: The repository cti-stix-slider supports development of a Python application to convert STIX 2.0 content to STIX 1.x content
Python
21
star
17

csaf-documentation

OASIS TC Open Repository: A GitHub repository for management of non-normative information about the work of the CSAF Technical Committee, including documentation
CSS
19
star
18

odata-rapid

Rapid - Specification, tools and libraries to support the development and adoption of simple REST-based APIs.
JavaScript
17
star
19

cti-sep-repository

OASIS TC Open Repository: STIX Enhancement Proposals (SEPs) https://github.com/oasis-open/cti-sep-repository
Shell
16
star
20

dita-stylesheets

OASIS TC Open Repository: Developing style sheets and other resources that can be used to build OASIS-styled publications from DITA source
XSLT
14
star
21

openc2-lycan-python

OASIS TC Open Repository: A GitHub public repository for development of a python library to transform between data-interchange formats (such as JSON) and python language objects
Python
11
star
22

dita-lightweight

OASIS TC Open Repository: Schema files, tools and documentation related to the Lightweight DITA Subcommittee.
9
star
23

tac-ontology

OASIS Threat Actor Context (TAC) TC: Creating an ontology for expressing the rich context around Threat Actors. https://github.com/oasis-open/tac-ontology
9
star
24

mqtt-sn-sample-resources

OASIS TC Open Repository: Contains a collection of MQTT-SN applications and libraries in any programming language, examples, samples and other educational materials. https://github.com/oasis-open/mqtt-sn-sample-resources
Java
8
star
25

openc2-jadn-software

OASIS TC Open Repository: Development and maintenance of JADN (JSON Abstract Data Notation), a JSON document format for defining abstract schemas.
Python
8
star
26

dita-rng-converter

OASIS TC Open Repository: The DITA RNG Converter provides cross-platform tools for generating DITA-conforming DTD- and XSD-format versions of RELAX NG DITA grammars: document type shells, vocabulary modules, and constraint modules. It makes it as easy as possible to develop and maintain DITA grammars by allowing use of RELAX NG syntax.
XSLT
7
star
27

openc2-lycan-java

OASIS TC Open Repository: A GitHub public repository for development of a java library to transform between data-interchange formats (such as JSON) and java language objects
Java
7
star
28

legalruleml-repo

OASIS TC Open Repository: Public GitHub repository for developing and distributing good examples in order to share knowledge about the correct application of LegalRuleML standard
5
star
29

openc2-oif-device

OASIS TC Open Repository: Supports development OpenC2 Integration Framework (OIF) Device
Python
5
star
30

openc2-lycan-beam

OASIS TC Open Repository: Developing a collection of applications and libraries, coded in languages that run on the BEAM virtual machine (e.g., erlang, elixir), for the purpose of implementing OpenC2
Erlang
5
star
31

cti-marking-prototype

OASIS TC Open Repository: Prototype for processing granular data markings in STIX
Python
4
star
32

openc2-oif-orchestrator

OASIS TC Open Repository: Supports development OpenC2 Integration Framework (OIF) Orchestrator
Python
4
star
33

dita-specializations

OASIS Darwin Information Typing Architecture (DITA) TC: This repository provides storage for DITA specializations that were developed by the DITA TC, but which are no longer part of the DITA standard. https://github.com/oasis-open/dita-specializations
4
star
34

cti-python-stix2-extensions

OASIS Python-STIX2 API extensions: a repository for python-stix2 API code developed for specification candidate extension definitions.
Jupyter Notebook
4
star
35

cacao-json-schemas

JSON validation schemas for CACAO Playbooks
4
star
36

emergency-emf

OASIS Emergency Management TC: The OASIS Emergency Management Framework (EMF) is a reference implementation and toolkit for enabling standardized emergency information exchange. https://github.com/oasis-open/emergency-emf
3
star
37

cti-cybox3-json-schemas

OASIS TC Open Repository: Non-normative schemas and examples for CybOX 3
3
star
38

openc2-custom-aps

OASIS TC Open Repository: Providing a publicly available repository for Custom Actuator Profiles and supporting collaborative development of OpenC2 Custom Actuator Profiles. https://github.com/oasis-open/openc2-custom-aps
3
star
39

openc2-iosacl-adapter

OASIS OpenC2 TC: A prototype implementation in R to transform between OpenC2 and Cisco ACL formats. The adapter supports access control list (ACL) management. https://github.com/oasis-open/openc2-iosacl-adapter
R
2
star
40

openc2-ocas

OASIS TC Open Repository: OpenC2 API Simulator (ocas) is an erlang/OTP application written in Erlang to demonstrate and exercise the OpenC2 specification
Erlang
2
star
41

openeox

OASIS TC Open Repository: OpenEoX Awareness and Adoption
1
star
42

tac-common-semantic-individuals

OASIS Threat Actor Context (TAC) TC: A repository for commonly used semantic individuals in order to avoid needless duplication. https://github.com/oasis-open/tac-common-semantic-individuals
1
star
43

openc2-compatibility

OASIS TC Open Repository: Supporting the capture of OpenC2 core design principles and development of implementation guidelines so that implementers can agree on language and protocols to build interoperable systems
1
star
44

dita-adoption-public

OASIS DITA Adoption TC: Helping promote the use and understanding of the DITA XML standard. https://github.com/oasis-open/dita-adoption-public
1
star
45

openc2-pub-sub-on-bsd

OASIS TC Open Repository: A prototype reference implementation that demonstrates OpenC2 working within a pub/sub environment
C
1
star
46

openc2-reactor-master

OASIS TC Open Repository: Reactor-master is a feedback-driven GUI master/actuator orchestration framework for the OpenC2 language, written in Python; it provides a way to administer multiple reactor-relay deployments
1
star
47

cti-interop

OASIS TC Open Repository: Advancing Cyber Threat Intelligence (CTI) Interoperability, including issue tracking, development of test-data useful for STIXPreferred, and management of other supporting content for the STIXPreferred program, which is open to all
1
star