Metadata-Version: 2.1
Name: PySTIXView
Version: 0.0.2
Summary: A Python library to create and display STIX2 graphs
Home-page: https://github.com/vincenzocaputo/PySTIXView
Author: Vincenzo Caputo
Author-email: Vincenzo Caputo <caputo.vincenzo@protonmail.com>
License: BSD 3-Clause License
        
        Copyright (c) 2024, Vincenzo Caputo
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://github.com/vincenzocaputo/PySTIXView
Project-URL: Issues, https://github.com/vincenzocaputo/PySTIXView/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE

# PySTIXView
![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) [![PyPI version](https://badge.fury.io/py/PySTIXview.svg)](https://badge.fury.io/py/PySTIXview) [![codecov](https://codecov.io/gh/vincenzocaputo/PySTIXView/graph/badge.svg?token=812G6NT5JP)](https://codecov.io/gh/vincenzocaputo/PySTIXView)

PySTXIView is a Python library to create and display STIX2 graphs.

PySTIXView is based on [pyvis](https://github.com/WestHealth/pyvis/) that allows you to create graph and visualize them in your browser or in Jupyter Notebook.

## Installation

### Requirements
- python3 (tested on python 3.12)
- pyvis
- [stix2](https://github.com/oasis-open/cti-python-stix2)

### Install from pip
```
pip install PySTIXview
```

### Install from source code

```
git clone https://github.com/vincenzocaputo/PySTIXView
cd PySTIXView
python3 setup.py install
```

## Usage

Below is a simple example to create a graph from the STIX2 Bundle [Threat Actor Leveraging Attack Patterns and Malware](https://oasis-open.github.io/cti-documentation/examples/threat-actor-leveraging-attack-patterns-and-malware). (The JSON file is available at https://github.com/oasis-open/cti-documentation/blob/main/examples/example_json/threat-actor-leveraging-attack-patterns-and-malware.json)

```python
from pystixview import PySTIXView

stix_graph = PySTIXView("600px", "100%")
with open("threat-actor-leveraging-attack-patterns-and-malware.json", "r") as fd:
    stix_graph.add_bundle(fd.read())
stix_graph.save_graph("threat-actor-leveraging-attack-patterns-and-malware.html")
```

PySTIXView can be used also in Jupyter Notebook:

![](https://raw.githubusercontent.com/vincenzocaputo/PySTIXView/main/_media/jupyter_example.png)

## Credits

- The resources used for examples and library tests are taken from https://oasis-open.github.io/cti-documentation/stix/examples.html.
- The images used in the library for the node icons are taken from https://github.com/freetaxii/stix2-graphics
