This project consists of an open source library allowing software to connect to data repositories using STIX Patterning, and return results as STIX Observations.
Requires Python 3.6
usage: stix_shifter.py translate [-h]
{qradar,dummy,aql_passthrough}
{results,query} data
positional arguments:
{qradar,dummy,aql_passthrough} What translation module to use
{results,query} What translation action to perform
data source A STIX identity object
data The data to be translated
optional arguments:
-h, --help show this help message and exit
-x run STIX validation on each observable as it's written to the output JSON
See the QRadar module documentation
See the QRadar module documentation
To create a new module that can be used when importing stix-shifter, follow these steps:
- Create a directory with the name of your module in the
stix-shifter/src/modules/directory - In
stix-shifter.py, add<module-name>to theMODULESarray at the top of the file - In your module directory, create a new python code file named
<module-name>_translator.py. This is where you'll be defining your concrete translator class- In
<module-name>_translator.py, define a class namedTranslatorand have it extendBaseTranslatorfromstix-shifter/src/modules/base/base_translator.py. (You can usestix-shifter/src/modules/dummy/dummy_translator.pyas an example) - In
__init__you need to assignself.result_translatorandself.query_translatorto the appropriate query and result translator you want your module to use. For example the QRadar translator usesJSONToStixas its result translator andStixToAQLas its query translator - You can write your own query and result translators as well, they must be based off of
BaseQueryTranslatorandBaseResultTranslatorfound instix-shifter/src/modules/base/. Again, you can use the dummy module as a decent example on how to setup the concrete classes found instix-shifter/src/modules/dummy/
- In
- Once you have this all set up you can invoke your module by running
stix_shifter.pyand passing in your translator module name as the first parameter. The second parameterquery or resultdetermines if your module runs the query or result translator. The third parameterdatais passed into your translator as the data that will be translated. If you've importedstix_shifter.pyinto other python code, you can invoke it by running thetranslate(module, translation_type, data)method - IMPORTANT: If you're including any json data files in your module, be sure to include the path in
MANIFEST.inso that it's included in the packaging
We are thrilled you are considering contributing! Please read our guidelines for contributing.
©️ Copyright IBM Corp. 2018
All code contained within this project repository or any subdirectories is licensed according to the terms of the Apache v2.0 license, which can be viewed in the file LICENSE.