Creates and plots a dependency graph for XSOAR content packs.
Project description
XSOAR Dependency Graph
XSOAR Dependency Graph is a Python utility to create a dependency graph of either an entire content repository or a single content pack.
Requirements
In order to create a dependency graph for you content, you need the content to be in Content Packs Structure. It is highly recommended to use a content repository similar to content-ci-cd-template as you probably want to use demisto-sdk to interact with or create content at some point.
Usage
Installation
PyPI
pip install xsoar-dependency-graph
Directly from GitHub
Bleeding edge versions can be installed using pip:
pip install git+https://github.com/tlium/xsoar-dependency-graph.git
Code examples
Please see plot_all_packs.py or plot_single_pack.py for detailed invocation and code examples. These two examples uses mock data in the tests/data/mock_content_repo directory, but it should be easy to use your own content repo instead.
How is the content graph constructed
The content repository path given as a constructor argument is analyzed. For each content pack, the following items are evaluated (in order):
- The Content Pack itself is added as a graph node
- Playbooks are added as nodes. Playbooks are parsed and nodes and edges are added for any script or playbook reference found.
- Layouts are added as nodes. Layouts are parsed and nodes and edges are added when they are found for e.g dynamic sections or buttons.
- Incident Types are added as nodes. Layouts are parsed and nodes and edges are added for script or playbook references.
- Integrations are added as nodes. The integrations are parsed and every command defined in the integration is added as graph nodes. Integration code as such is not yet parsed.
- Scripts are added as nodes. If there is no path between Content Pack (1) and script then an edge is created from Content Pack node to script node. The scripts themselves are parsed as an Abstract Syntax Tree. When calls to
execute_commandordemisto.executeCommandare found, the scripts being called are added as graph nodesth an edge back to the calling script.
I can create a content graph with demisto-sdk, so how does this differ?
I have a slightly different opinion on how the content graph should be constructed. One example is I don't want all content items in a content pack to have an edge back to the content graph as such. I also want edges between scripts so that I can easily see exactly which other scripts a script is dependent upon and not only a dependency back to the content pack. Furthermore, demisto-sdk will do all sorts of validation of content which I don't care about. If you have weird docker image definitions in your content that's your business. I also prefer to plot my graphs with matplotlib initially. Unlike demisto-sdk, I don't care about visualizing the graphs in Neo4j. I would much rather export (this feature is not yet implemented) the finished graph to a format Neo4j can read, so that people can decide for themselves how they would like the graphs to be used.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xsoar_dependency_graph-0.2.1.tar.gz.
File metadata
- Download URL: xsoar_dependency_graph-0.2.1.tar.gz
- Upload date:
- Size: 58.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd7bf33dccb3dfc1fec90f3ae274fdc96038e501bb6112de522ff8761d0b2551
|
|
| MD5 |
9f5acb1470c87fbdb03b9a97ed5fca78
|
|
| BLAKE2b-256 |
5df2e7d7b087d556b216a3f878ae91f00a138dc2a0ae23b4f55bb1d7a11df4ef
|
Provenance
The following attestation bundles were made for xsoar_dependency_graph-0.2.1.tar.gz:
Publisher:
release.yaml on tlium/xsoar-dependency-graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xsoar_dependency_graph-0.2.1.tar.gz -
Subject digest:
cd7bf33dccb3dfc1fec90f3ae274fdc96038e501bb6112de522ff8761d0b2551 - Sigstore transparency entry: 970912753
- Sigstore integration time:
-
Permalink:
tlium/xsoar-dependency-graph@63098e324677269ddb712c6c02b75d4ad7f07bab -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/tlium
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@63098e324677269ddb712c6c02b75d4ad7f07bab -
Trigger Event:
push
-
Statement type:
File details
Details for the file xsoar_dependency_graph-0.2.1-py2.py3-none-any.whl.
File metadata
- Download URL: xsoar_dependency_graph-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c88baf4f9db27f50340b987121d8ac0f6ccd59f46aa5ab19ac3e5027bc99902
|
|
| MD5 |
98e43205e0eec7a76f3b5dab6fa41efb
|
|
| BLAKE2b-256 |
99819d1e81f2f70c1c7938656a424d6e270326643569818ff8d43708fdfba694
|
Provenance
The following attestation bundles were made for xsoar_dependency_graph-0.2.1-py2.py3-none-any.whl:
Publisher:
release.yaml on tlium/xsoar-dependency-graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xsoar_dependency_graph-0.2.1-py2.py3-none-any.whl -
Subject digest:
9c88baf4f9db27f50340b987121d8ac0f6ccd59f46aa5ab19ac3e5027bc99902 - Sigstore transparency entry: 970912797
- Sigstore integration time:
-
Permalink:
tlium/xsoar-dependency-graph@63098e324677269ddb712c6c02b75d4ad7f07bab -
Branch / Tag:
refs/tags/0.2.1 - Owner: https://github.com/tlium
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@63098e324677269ddb712c6c02b75d4ad7f07bab -
Trigger Event:
push
-
Statement type: