https://github.com/vincenzocaputo/pystixview
A Python library to create and display STIX2 graphs
https://github.com/vincenzocaputo/pystixview
graph jupyter-notebook pyvis stix2
Last synced: 3 months ago
JSON representation
A Python library to create and display STIX2 graphs
- Host: GitHub
- URL: https://github.com/vincenzocaputo/pystixview
- Owner: vincenzocaputo
- License: bsd-3-clause
- Created: 2024-03-03T10:45:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-24T00:31:16.000Z (10 months ago)
- Last Synced: 2025-01-31T06:51:20.744Z (9 months ago)
- Topics: graph, jupyter-notebook, pyvis, stix2
- Language: Python
- Homepage:
- Size: 14.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PySTIXView
 [](https://badge.fury.io/py/PySTIXview) [](https://codecov.io/gh/vincenzocaputo/PySTIXView) [](https://pystixview.readthedocs.io/en/latest/?badge=latest) [](https://github.com/marketplace/actions/super-linter) [](https://opensource.org/licenses/BSD-3-Clause)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
pip 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 PySTIXViewstix_graph = PySTIXView()
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", width="100%", height="600px")
```PySTIXView can be used also in Jupyter Notebook:

## Documentation
Documentation is available [here](https://pystixview.readthedocs.io/en/latest/)
## 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