Siopy/n8n-nodes-opencti
GitHub: Siopy/n8n-nodes-opencti
这是一个用于集成开源威胁情报平台 OpenCTI 的 n8n 社区节点,支持通过工作流自动化管理威胁情报实体与关联关系。
Stars: 1 | Forks: 0
# n8n-nodes-opencti
用于 [OpenCTI](https://www.opencti.io/)(一个开源网络威胁情报 (CTI) 平台)的定制 [n8n](https://n8n.io/) 社区节点。
该节点通过 OpenCTI 的 GraphQL API 进行通信,可直接从您的 n8n 工作流中管理威胁情报数据。
## 目录
- [安装](#installation)
- [支持的资源](#supported-resources)
- [凭证设置](#credentials-setup)
- [开发](#development)
- [使用示例](#usage-examples)
- [资源参考](#resource-reference)
## 安装
### 从 n8n 社区节点安装(推荐)
1. 打开您的 n8n 实例
2. 前往 **Settings > Community Nodes**
3. 点击 **Install a community node**
4. 输入 `n8n-nodes-opencti`
5. 点击 **Install**
### 从 npm 安装(手动)
```
cd ~/.n8n
npm install n8n-nodes-opencti
```
然后重启 n8n。
## 支持的资源
| 资源 | 创建 | 获取 | 搜索 | 更新 | 删除 |
|---|:---:|:---:|:---:|:---:|:---:|
| **Attack Pattern** (MITRE ATT&CK) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Campaign** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **City** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Country** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Course of Action** (MITRE Mitigation) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **External Reference** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Incident** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Indicator** (STIX, YARA, Sigma, Snort...) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Individual** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Infrastructure** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Intrusion Set** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Kill Chain Phase** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Label** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Malware** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Marking Definition** (TLP, PAP) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Note / RFI** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Observable** (STIX Cyber Observable) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Observed Data** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Opinion** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Position** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Region** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Relationship** (STIX Core Relationship) | ✅ | ✅ | ✅ | - | ✅ |
| **Report** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Sector** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Sighting** (STIX Sighting Relationship) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **System** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Task** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Threat Actor** | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Tool** (STIX Tool) | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Vulnerability** (CVSS, EPSS, CISA KEV) | ✅ | ✅ | ✅ | ✅ | ✅ |
### 支持的 Observable 类型
IPv4, IPv6, Domain Name, URL, Email Address, Hostname, File, MAC Address, User Account, Software, Process, Network Traffic, Windows Registry Key, X509 Certificate, Autonomous System, Cryptocurrency Wallet, Cryptographic Key, Phone Number, Bank Account, Credential, Tracking Number, Text, User Agent, Media Content, Mutex.
### 支持的关系类型
| 类型 | 描述 |
|---|---|
| `object` | 将对象添加到容器(Report、Note 等)中 |
| `related-to` | 两个实体之间的通用关系 |
| `uses` | 攻击者/恶意软件使用了工具/技术 |
| `targets` | 针对某个实体(行业、国家、组织)的攻击 |
| `indicates` | Indicator 指示了某种威胁 |
| `attributed-to` | 将活动归因于某个攻击者 |
| `exploits` | 利用某个漏洞 |
| `mitigates` | 缓解措施 |
| `delivers` / `drops` | 恶意软件投递/放置 |
| `communicates-with` | 网络通信 |
| `based-on` / `derived-from` | 派生关系 |
| `located-at` | 地理位置 |
| `variant-of` / `part-of` | 结构关系 |
## 凭证设置
1. 在浏览器中打开 n8n(例如:`http://localhost:5678`)
2. 前往 **Credentials > New Credential**
3. 搜索 **OpenCTI API**
4. 填写字段:
| 字段 | 描述 | 示例 |
|---|---|---|
| **API URL** | 您的 OpenCTI 实例的基础 URL(末尾不带 `/`) | `https://opencti.example.com` |
| **API Key** | API 密钥(OpenCTI > Profile > API access) | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
5. 点击 **Test** 验证连接
6. 保存
## 开发
### 项目结构
```
n8n-nodes-opencti/
├── .github/workflows/
│ ├── ci.yml # GitHub Actions CI (lint + build)
│ └── publish.yml # Publish to npm with provenance
├── .vscode/
│ └── launch.json # VSCode debugger config
├── credentials/
│ └── OpenCtiApi.credentials.ts # Credentials (auth + connection test)
├── nodes/OpenCti/
│ ├── OpenCti.node.ts # Main node with execute()
│ ├── OpenCti.node.json # Codex metadata
│ ├── opencti.svg # Official OpenCTI icon
│ ├── GenericFunctions.ts # Helpers: GraphQL requests, filters, dates
│ └── descriptions/ # UI descriptions per resource
│ ├── AttackPatternDescription.ts
│ ├── CampaignDescription.ts
│ ├── CityDescription.ts
│ ├── CountryDescription.ts
│ ├── CourseOfActionDescription.ts
│ ├── ExternalReferenceDescription.ts
│ ├── IncidentDescription.ts
│ ├── IndicatorDescription.ts
│ ├── IndividualDescription.ts
│ ├── InfrastructureDescription.ts
│ ├── IntrusionSetDescription.ts
│ ├── KillChainPhaseDescription.ts
│ ├── LabelDescription.ts
│ ├── MalwareDescription.ts
│ ├── MarkingDefinitionDescription.ts
│ ├── NoteDescription.ts
│ ├── ObservableDescription.ts
│ ├── ObservedDataDescription.ts
│ ├── OpinionDescription.ts
│ ├── PositionDescription.ts
│ ├── RegionDescription.ts
│ ├── RelationshipDescription.ts
│ ├── ReportDescription.ts
│ ├── SectorDescription.ts
│ ├── SightingDescription.ts
│ ├── SystemDescription.ts
│ ├── TaskDescription.ts
│ ├── ThreatActorDescription.ts
│ ├── ToolDescription.ts
│ ├── VulnerabilityDescription.ts
│ └── index.ts
├── .prettierrc.js # Prettier config
├── eslint.config.mjs # ESLint config
├── package.json
├── tsconfig.json
├── CHANGELOG.md
├── LICENSE
└── README.md
```
## 使用示例
### 创建一个 observable 并将其添加到报告中
```
1. OpenCTI > Observable > Create
- Type: IPv4 Address
- Value: 192.168.1.1
- Score: 80
- Labels:
标签:API, Cloudflare, GraphQL, MITM代理, MITRE ATT&CK, n8n, OpenCTI, Shodan, STIX, YARA, 云资产可视化, 入侵集, 可观测对象, 威胁情报管理, 工作流自动化, 恶意软件, 指标, 社区节点, 缓解措施, 网络威胁情报, 网络安全, 自动化攻击, 隐私保护, 集成工具