8
n8n 中文网amn8n.com

使用HIBP API的自动化数据泄露监控

中级

这是一个SecOps领域的自动化工作流,包含 7 个节点。主要使用 If, Code, Slack, HttpRequest, ScheduleTrigger 等节点。 使用HIBP API监控邮箱数据泄露并发送Slack警报

前置要求
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "2Sx7R4CGxcRmr5gV",
  "meta": {
    "instanceId": "a287613f1596da776459594685fbf4e2b4a12124f80ab8c8772f5e37bff103ae"
  },
  "name": "使用 HIBP API 的自动化数据泄露监控",
  "tags": [],
  "nodes": [
    {
      "id": "5d16601e-79e7-4071-a0f0-dce718bf3e25",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "15146ef4-c973-437d-aaa0-961a9ce6f671",
      "name": "列出待检查邮箱",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        0
      ],
      "parameters": {
        "jsCode": "const emailsToCheck = [\n    \"user1@yourcompany.com\",\n    \"user2@yourcompany.com\",\n    \"admin@yourcompany.com\"\n];\n\nreturn emailsToCheck.map(email => ({\n    json: { email: email }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "d7fcb0a4-307b-4454-a515-615bb32614da",
      "name": "查询 HIBP API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        416,
        0
      ],
      "parameters": {
        "url": "=https://api.pwnedpasswords.com/range/{{ encodeURIComponent($json.email) }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "e7201557-fd32-4bca-a6c8-e053df5553b3",
      "name": "是否泄露?",
      "type": "n8n-nodes-base.if",
      "position": [
        624,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5ceba6a6-a52f-4ed8-85b8-5e68e0cda8ac",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.body }} ",
              "rightValue": "[]"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d7bfc8f4-9067-40ce-ae3c-8f96203404fc",
      "name": "发送高优先级警报",
      "type": "n8n-nodes-base.slack",
      "position": [
        880,
        0
      ],
      "webhookId": "7001b3bc-3d19-40cb-b34a-a6bcc8b01f11",
      "parameters": {
        "text": "=🚨 *URGENT: Data Breach Alert!* 🚨\\nEmail address *{{ $json.email }}* was found in a data breach.\\nImmediate action is required!",
        "user": {
          "__rl": true,
          "mode": "id",
          "value": "[YOUR_SECURITY_ALERT_CHANNEL_ID]"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "AFKF0YsguyhsagR0",
          "name": "temp"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0375f848-bb60-42cb-9c69-23d2d5fb0c26",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -48
      ],
      "parameters": {
        "width": 1184,
        "height": 240,
        "content": "## 流程"
      },
      "typeVersion": 1
    },
    {
      "id": "02e3c3f0-0cf3-4bf3-9b7b-4b6bec91d354",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 1184,
        "height": 1200,
        "content": "## 问题"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c349e3f7-69f0-4039-9b6f-5dd5a0787987",
  "connections": {
    "Is Breached?": {
      "main": [
        [
          {
            "node": "Send High-Priority Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query HIBP API": {
      "main": [
        [
          {
            "node": "Is Breached?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "List Emails to Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Emails to Check": {
      "main": [
        [
          {
            "node": "Query HIBP API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 安全运维

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量7
分类1
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Marth

Marth

@marth

Simplifying Business with Smart Automation. I create and share user-friendly, highly efficient n8n workflow templates for SMEs, focusing on digital marketing, sales, and operational excellence. Get ready to automate, innovate, and elevate your business. Connect me on Linkedin for custom solutions.

外部链接
在 n8n.io 查看

分享此工作流