stix2arango is a command line tool that takes a group of STIX 2.1 objects in a bundle and inserts them into ArangoDB. It can also handle updates to existing objects in ArangoDB imported in a bundle.
Project description
stix2arango
Overview
stix2arango is a command line tool that takes a group of STIX 2.1 objects in a bundle and inserts them into ArangoDB. It can also handle updates to existing objects in ArangoDB imported in a bundle.
- STIX 2.1 bundle entered
- User chooses database/collection names (stix2arango creates as needed)
- stix2arango inserts objects (or updates them) and then generates any relationships between them
tl;dr
Usage
Install the script
# clone the latest code
git clone https://github.com/muchdogesec/stix2arango
# create a venv
cd stix2arango
python3 -m venv stix2arango-venv
source stix2arango-venv/bin/activate
# install requirements
pip3 install .
Note, the installation assumes ArangoDB is already installed locally.
You can install ArangoDB here. stix2arango is compatible with both the Enterprise and Community versions.
A note for Mac users
Fellow Mac users, ArangoDB can be installed and run using homebrew as follows;
## Install
brew install arangodb
## Run
brew services start arangodb
## will now be accessible in a browser at: http://127.0.0.1:8529 . Default username is root with no password set (leave blank)
## Stop
brew services stop arangodb
Configuration options
stix2arango has various settings that are defined in an .env file.
To create a template for the file:
cp .env.example .env
To see more information about how to set the variables, and what they do, read the .env.markdown file.
Run
python3 stix2arango.py \
--file PATH/TO/STIX.json \
--database NAME \
--collection NAME \
--stix2arango_note SOMETHING \
--ignore_embedded_relationships BOOLEAN
Where;
--file(required): is the path to the valid STIX 2.1 bundle .json file--database(required): is the name of the Arango database the objects should be stored in. If database does not exist, stix2arango will create it--collection(required): is the name of the Arango collection in the database specified the objects should be stored in. If the collection does not exist, stix2arango will create it--stix2arango_note(optional): Will be stored under the_stix2arango_notecustom attribute in ArangoDB. Useful as can be used in AQL.a-zcharacters only. Max 24 chars.--ignore_embedded_relationships(optional, boolean): iftruepassed, this will stop ANY embedded relationships from being generated. This applies for all object types (SDO, SCO, SRO, SMO). If you want to target certain object types seeignore_embedded_relationships_sroandignore_embedded_relationships_sroflags.Default isfalse`--ignore_embedded_relationships_sro(optional, boolean): iftruepassed, will stop any embedded relationships from being generated from SRO objects (type=relationship). Default isfalse--ignore_embedded_relationships_smo(optional, boolean): iftruepassed, will stop any embedded relationships from being generated from SMO objects (type=marking-definition,extension-definition,language-content). Default isfalse--is_large_file(pass flag): Use this mode when the bundle is very large (>100mb), this will chunk the input into multiple files before loading into memory.
For example, using the MITRE ATT&CK Enterprise bundle;
python3 stix2arango.py \
--file cti_knowledge_base_store/mitre-attack-enterprise/enterprise-attack-15_1.json \
--database stix2arango_demo \
--collection demo_1 \
--stix2arango_note v15.1 \
--ignore_embedded_relationships true \
--is_large_file
If you want to include embedded relationships as edges in the ArangoDB collection, you would run;
python3 stix2arango.py \
--file cti_knowledge_base_store/mitre-attack-enterprise/enterprise-attack-15_1.json \
--database stix2arango_demo \
--collection demo_2 \
--stix2arango_note v15.1 \
--ignore_embedded_relationships false \
--is_large_file
A note on embedded relationships
stix2arango can handle all embedded references to other STIX objects under _ref and _refs properties in a STIX object when --ignore_embedded_relationships is set to false.
e.g.
{
"type": "x-mitre-tactic",
"spec_version": "2.1",
"id": "x-mitre-tactic--b977ad29-eb0c-5f09-bb2f-6d3f23e2a175",
"created_by_ref": "identity--8700e156-6ce9-5090-8589-f9d0aef7bdb7",
For the above object a STIX SRO would be generated by stix2arango with source_ref=x-mitre-tactic--b977ad29-eb0c-5f09-bb2f-6d3f23e2a175, target_ref=identity--8700e156-6ce9-5090-8589-f9d0aef7bdb7 and relationship_type=created-by.
Quickstart
We store a lot of STIX data from popular knowledgebases on Cloudflare R2.
This is a useful resource to quickly populate STIX data using stix2arango if you want to see what it can do.
To populate this data for yourself, check out utilities/README.md for import scripts.
Useful supporting tools
- To generate STIX 2.1 Objects: stix2 Python Lib
- The STIX 2.1 specification: STIX 2.1 docs
- ArangoDB docs
Support
Minimal support provided via the DOGESEC community.
License
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 stix2arango-0.0.5.tar.gz.
File metadata
- Download URL: stix2arango-0.0.5.tar.gz
- Upload date:
- Size: 5.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
711735a08a589f76ddf238f81feebc30559d2dfbb0399344e01914d68d548416
|
|
| MD5 |
31d21cae638840d64b72692ef74c5007
|
|
| BLAKE2b-256 |
9ddd9e671a05227ee7d2dfc5a7eef128fb3765900c86f51e013af9ae6b157f7d
|
Provenance
The following attestation bundles were made for stix2arango-0.0.5.tar.gz:
Publisher:
create-release.yml on muchdogesec/stix2arango
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stix2arango-0.0.5.tar.gz -
Subject digest:
711735a08a589f76ddf238f81feebc30559d2dfbb0399344e01914d68d548416 - Sigstore transparency entry: 257536756
- Sigstore integration time:
-
Permalink:
muchdogesec/stix2arango@02e576f84f8687aa332b137703340cf08a63d1c3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/muchdogesec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
create-release.yml@02e576f84f8687aa332b137703340cf08a63d1c3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stix2arango-0.0.5-py3-none-any.whl.
File metadata
- Download URL: stix2arango-0.0.5-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
239b2a3c8bdec4601bb0e99325a9f7832927661d05b4a541a9f6ef6534112663
|
|
| MD5 |
a7885fc8830a6b849f11fa51a53ab2e2
|
|
| BLAKE2b-256 |
5c2b8a07e7e7c72d83f6e31aa98f197cfc3270f4f2dc3db8a0124a35c8a0666a
|
Provenance
The following attestation bundles were made for stix2arango-0.0.5-py3-none-any.whl:
Publisher:
create-release.yml on muchdogesec/stix2arango
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stix2arango-0.0.5-py3-none-any.whl -
Subject digest:
239b2a3c8bdec4601bb0e99325a9f7832927661d05b4a541a9f6ef6534112663 - Sigstore transparency entry: 257536758
- Sigstore integration time:
-
Permalink:
muchdogesec/stix2arango@02e576f84f8687aa332b137703340cf08a63d1c3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/muchdogesec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
create-release.yml@02e576f84f8687aa332b137703340cf08a63d1c3 -
Trigger Event:
push
-
Statement type: