Tools and interface to translate STIX formatted results and queries to different data source formats and to set up appropriate connection strings for invoking and triggering actions in openwhisk
Project description
Join us on Slack!
Click here and fill out the form to receive an invite to the Open Cybersecurity Alliance slack instance, then join the #stix-shifter channel, to meet and discuss usage with the team.
Introduction Webinar!
Click here to view an introduction webinar on STIX Shifter and the use cases it solves for.
Introduction
STIX-shifter is an open source python library allowing software to connect to products that house data repositories by using STIX Patterning, and return results as STIX Observations.
For more information about this project, see the STIX-shifter Overview
Dependencies
This stix-shifter has the following dependencies:
- stix2-patterns==1.3.0
- stix2-validator==1.1.2
- stix2-matcher==1.0.0
- antlr4-python3-runtime==4.8
- python-dateutil==2.8.1
Your development environment must use Python version: 3.6, 3.7, 3.8 or 3.9
Installation
The recommended method for installing the STIX-shifter is via pip. Two prerequisite packages needs to be installed inlcuding the package of stix-shifter connector module to complete a stix-shifter connector installation. Run below commands to install all the packages-
-
Main stix-shifter package:
pip install stix-shifter
-
Stix-shifter Utility package:
pip install stix-shifter-utils
-
Desired stix-shifter connector module package:
pip install stix-shifter-modules-<module name>
Example:pip install stix-shifter-modules-qradar
Usage
As A Command Line Utility
The STIX-Shifter comes with a bundled script which you can use to translate STIX Pattern to a native datasource query. It can also be used to translate a JSON data source query result to a STIX bundle of observable objects. You can also send query to a datasource by using a transmission option.
More details of the command line option can be found here
$ stix-shifter translate <MODULE NAME> query "<STIX IDENTITY OBJECT>" "<STIX PATTERN>" "<OPTIONS>"
Example:
$ stix-shifter translate qradar query {} "[ipv4-addr:value = '127.0.0.1']" {}
In order to build stix-shifter
packages from source follow the below prerequisite steps:
- Go to the stix-shifter parent directory
- Optionally, you can create a Python 3 virtual environemnt:
virtualenv -p python3 virtualenv && source virtualenv/bin/activate
- Run setup:
python3 setup.py install
Running From the Source
You may also use python3 main.py
script. All the options are the same as "As a command line utility" usage above.
Example:
python3 main.py translate qradar query {} "[ipv4-addr:value = '127.0.0.1']" {}
In order to run python3 main.py
from the source follow the below prerequisite steps:
- Go to the stix-shifter parent directory
- Optionally, you can create a Python 3 virtual environemnt:
virtualenv -p python3 virtualenv && source virtualenv/bin/activate
- Run setup to install dependancies:
INSTALL_REQUIREMENTS_ONLY=1 python3 setup.py install
.
Note: setup.py only installs dependencies when INSTALL_REQUIREMENTS_ONLY=1 directive is used. This option is similar to python3 generate_requirements.py && pip install -r requirements.txt
As A Library
You can also use this library to integrate STIX Shifter into your own tools. You can translate a STIX Pattern:
from stix_shifter.stix_translation import stix_translation
translation = stix_translation.StixTranslation()
response = translation.translate('<MODULE NAME>', 'query', '{}', '<STIX PATTERN>', '<OPTIONS>')
print(response)
Contributing
We are thrilled you are considering contributing! We welcome all contributors.
Please read our guidelines for contributing.
Guide for creating new connectors
If you want to create a new connector for STIX-shifter, see the developer guide
Licensing
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
More Resources
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 Distributions
Built Distribution
Hashes for stix_shifter_modules_elastic_ecs-4.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6be1f75c82105b685c684568b89fae4dba4f9a7358bc9b3c30104b8972f8d716 |
|
MD5 | 2d07441a9cd06db01b94f31fad0ea7cf |
|
BLAKE2b-256 | c68d3532163f89eba85334f04c637488647a6535574326de317c55f923285fdc |