opencybersecurityalliance/stix-shifter

GitHub: opencybersecurityalliance/stix-shifter

实现安全数据源与 STIX 标准互通的开源 Python 适配器库,支持将 STIX 模式转换为原生查询并标准化结果。

Stars: 261 | Forks: 229

[![example workflow](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/cb4a3964d9011406.svg)](https://github.com/opencybersecurityalliance/stix-shifter/actions) [![codecov](https://codecov.io/gh/opencybersecurityalliance/stix-shifter/branch/develop/graph/badge.svg?token=gQvl14peRj)](https://codecov.io/gh/opencybersecurityalliance/stix-shifter) # 简介 STIX-shifter 是一个开源 Python 库,允许软件通过使用 STIX Patterning 连接到包含数据存储库的产品,并将结果作为 STIX Observations 返回。 该库接收 STIX 2 Patterns 作为输入,并在包含网络安全数据存储库的各种产品中“查找”与模式匹配的数据。此类产品的示例包括 SIEM 系统、端点管理系统、威胁情报平台、编排平台、网络控制点、数据湖等。 除了使用这些模式“查找”数据外,STIX-Shifter 还将 _输出转换_ 为 STIX 2 Observations。你可能会问为什么要这样做?简单来说——这样所有的安全数据,无论来源如何,其外观和行为在很大程度上都是一致的。 ***项目文档*** 有关 STIX、本项目和命令行工具的常规信息,请参阅 [STIX-shifter 文档](https://stix-shifter.readthedocs.io/) ## 安装 推荐的 stix-shifter 安装方法是通过 pip。需要安装两个前置包,包括 stix-shifter connector 模块包,以完成 stix-shifter connector 的安装。运行以下命令来安装所有包: 1. Main stix-shifter package: `pip install stix-shifter` 2. Stix-shifter Utility package: `pip install stix-shifter-utils` 3. Desired stix-shifter connector module package: `pip install stix-shifter-modules- ` 示例: `pip install stix-shifter-modules-qradar` ### 依赖项 STIX-shifter 要求 Python 3.10 或更高版本。有关库依赖项,请参阅 [requirements 文件](../stix_shifter/requirements.txt)。 ## 使用 STIX-Shifter 可以通过以下方式使用: ### 作为命令行工具 STIX-Shifter 附带一个捆绑脚本,你可以使用它将 STIX Pattern 转换为原生的数据源查询。它还可以用于将 JSON 数据源查询结果转换为可观察对象的 STIX bundle。你也可以使用传输选项向数据源发送查询。 有关命令行选项的更多详细信息可以在 [这里](OVERVIEW.md#how-to-use) 找到 ``` $ stix-shifter translate query "" "" "" ``` 示例: ``` $ stix-shifter translate qradar query {} "[ipv4-addr:value = '127.0.0.1']" {} ``` 为了从源代码构建 `stix-shifter` 包,请执行以下前置步骤: 1. 进入 stix-shifter 父目录 2. 或者,你可以创建一个 Python 3 虚拟环境: `virtualenv -p python3 virtualenv && source virtualenv/bin/activate` 3. 运行安装: `python -m build_tools.run_build install` ### 从源代码运行 你也可以使用 `python3 main.py` 脚本。所有选项与上述命令行工具相同。 示例: ``` python3 main.py translate qradar query {} "[ipv4-addr:value = '127.0.0.1']" {} ``` 为了从源代码运行 `python3 main.py`,请执行以下前置步骤: 1. 进入 stix-shifter 父目录 2. 或者,你可以创建一个 Python 3 虚拟环境: `virtualenv -p python3 virtualenv && source virtualenv/bin/activate` 3. 运行安装以安装依赖项: `INSTALL_REQUIREMENTS_ONLY=1 python3 -m build_tools.run_build install`。 **注意:** 只有当使用 INSTALL_REQUIREMENTS_ONLY=1 指令时,`build_tools.run_build` 才会安装依赖项。此选项类似于 `python3 -m build_tools.pre_build && pip install -r requirements.txt` ### 作为库 你也可以使用此库将 STIX Shifter 集成到你自己的工具中。你可以转换 STIX Pattern: ``` from stix_shifter.stix_translation import stix_translation translation = stix_translation.StixTranslation() response = translation.translate('', 'query', '{}', '', '') print(response) ``` ### 使用自定义映射 如果 connector 是使用 pip 安装的,编辑 STIX 映射的过程与拉取项目源码是不同的。在本地工作时,你可以直接编辑映射文件。以 [MySQL connector 的映射文件](https://github.com/opencybersecurityalliance/stix-shifter/tree/develop/stix_shifter_modules/mysql/stix_translation/json) 为例。如果 connector 是通过 pip 安装的,编辑映射文件将不起作用;stix-shifter 包的安装脚本会将映射包含在 `config.json` 中。这允许 stix-shifter 作为 connector 配置的一部分摄取自定义映射。 有关如何编辑配置中的映射的更多详细信息,请参阅 [使用自定义映射](adapter-guide/custom_mappings.md)。 ## [Connector 开发指南](adapter-guide/develop-stix-adapter.md) ## [CLI 工具和 Connector 开发实验室](lab/README.md) # 许可 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. # 更多资源 ## 加入我们的 Slack! [点击这里](https://docs.google.com/forms/d/1vEAqg9SKBF3UMtmbJJ9qqLarrXN5zeVG3_obedA3DKs) 并填写表格以接收 Open Cybersecurity Alliance slack 实例的邀请,然后加入 #stix-shifter 频道,与团队会面并讨论使用情况。 ## 简介网络研讨会! [点击这里](https://ibm.biz/BdzTyA) 查看关于 STIX Shifter 及其解决的用例的简介网络研讨会。 ## 更新日志 - [更新日志](../CHANGELOG.md)
标签:EDR, FTP漏洞扫描, Homebrew安装, OCA, Python, STIX, STIX-Shifter, STIX模式, STIX观察对象, 互操作性, 入侵检测系统, 威胁情报, 安全数据湖, 安全编排, 开发者工具, 开放网络安全联盟, 开源库, 搜索引擎爬虫, 数据查询, 数据转换, 数据连接器, 无后门, 网络安全, 脆弱性评估, 逆向工具, 隐私保护