8
n8n 中文网amn8n.com

IP 地理位置与 HTTP 端口扫描器

中级

这是一个SecOps, Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 Set, Code, SplitOut, HttpRequest, GoogleSheets 等节点。 IP 地理位置定位和 HTTP 端口扫描(集成 Google Sheets)

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "ZUiF05eiy3I0zdls",
  "meta": {
    "instanceId": "a28fa941f4dd50ba130162204d368b9dfd7d9b960d864f7ae0094ae8b516daa8",
    "templateCredsSetupCompleted": true
  },
  "name": "IP_信息_与_HTTP端口扫描器",
  "tags": [],
  "nodes": [
    {
      "id": "d48dee47-1fed-49fe-bf32-9b6b9982616e",
      "name": "Google Sheets 触发器",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -416,
        -16
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI/edit?usp=drivesdk",
          "cachedResultName": "IP-Info"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "7konaOydpAUB7WbP",
          "name": "GoogleSheetsTriggerMyAccount"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc06f30b-8083-4e3b-8923-09f743ad7858",
      "name": "更新_IP_信息_行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        48,
        -16
      ],
      "parameters": {
        "columns": {
          "value": {
            "IP": "={{ $json.query }}",
            "ISP": "={{ $json.isp }}",
            "Lat": "={{ $json.lat }}",
            "Lon": "={{ $json.lon }}",
            "Org": "={{ $json.org }}",
            "City": "={{ $json.city }}",
            "Country": "={{ $json.country }}"
          },
          "schema": [
            {
              "id": "IP",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "IP",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Country",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "City",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "City",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lat",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lat",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lon",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lon",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ISP",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ISP",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Org",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Org",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "IP"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI/edit?usp=drivesdk",
          "cachedResultName": "IP-Info"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "j3NaEGOZ7YCvCMQu",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5a0d22ee-2fb5-48e4-9000-e6799420bd8c",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        480,
        -16
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "ports",
        "fieldsToInclude": "IP"
      },
      "typeVersion": 1
    },
    {
      "id": "dcf55b8f-76b2-4f9f-96c8-93dec9258495",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        256,
        -16
      ],
      "parameters": {
        "include": "selected",
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "60aefa6f-50dd-484e-af28-a65e7cc695c8",
              "name": "ports",
              "type": "array",
              "value": "[80,443,8080,8000,3000]"
            }
          ]
        },
        "includeFields": "IP",
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "8504d3c2-186c-4534-b3c9-b23641e2a47a",
      "name": "更新_HTTP_端口_状态",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1152,
        -16
      ],
      "parameters": {
        "columns": {
          "value": {
            "IP": "={{ $('Split Out').first().json.IP }}",
            "Port_80": "={{ $json.result['80'] }}",
            "Port_443": "={{ $json.result['443'] }}",
            "PORT_3000": "={{ $json.result['3000'] }}",
            "Port_8000": "={{ $json.result['8000'] }}",
            "Port_8080": "={{ $json.result['8080'] }}"
          },
          "schema": [
            {
              "id": "IP",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "IP",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Country",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "City",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "City",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lat",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Lat",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lon",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Lon",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ISP",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "ISP",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Org",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Org",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Port_80",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Port_80",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Port_443",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Port_443",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Port_8000",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Port_8000",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Port_8080",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Port_8080",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "PORT_3000",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "PORT_3000",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "IP"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19MSjNyjzs1FeRI5_QLiVk8Hi9JNt5HD1bNulfpB6SzI/edit?usp=drivesdk",
          "cachedResultName": "IP-Info"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "j3NaEGOZ7YCvCMQu",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "fe67923f-d24f-404b-a16f-6d860a8531ac",
      "name": "检查HTTP端口",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        704,
        -16
      ],
      "parameters": {
        "url": "=http://{{ $json.IP }}:{{$json.ports}}/",
        "options": {
          "timeout": 10000,
          "allowUnauthorizedCerts": true
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0b9969ad-6e89-4432-931d-311ea510fbb5",
      "name": "全部合并至单项",
      "type": "n8n-nodes-base.code",
      "position": [
        928,
        -16
      ],
      "parameters": {
        "jsCode": "function startsWithHttpCode(error) {\n  return /^\\s*\\d{3}\\b/.test(error);\n}\n\n// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconst result = {};\nlet index = 0;\nfor (const item of $input.all()) {\n  const portItem = $(\"Split Out\").itemMatching(index).json;\n    \n  if(item.json.error)\n    result[portItem.ports] = startsWithHttpCode(item.json.error.message);\n  else\n    result[portItem.ports] = true;\n  index++;\n}\n\nreturn {result};"
      },
      "typeVersion": 2
    },
    {
      "id": "757ec413-fe8a-44c8-ac9c-49fc5694f59a",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -384
      ],
      "parameters": {
        "width": 704,
        "height": 224,
        "content": "## 使用 Google Sheets 触发器自动执行IP地理位置查询和HTTP端口扫描"
      },
      "typeVersion": 1
    },
    {
      "id": "d442a1dc-be9c-4768-8350-584c8b291aa5",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -96
      ],
      "parameters": {
        "color": 6,
        "height": 240,
        "content": "当包含IP地址的新行添加到您的 Google 表格时触发"
      },
      "typeVersion": 1
    },
    {
      "id": "7cfbe7d3-cf98-441b-a8a8-910c778deaed",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -96
      ],
      "parameters": {
        "color": 6,
        "width": 208,
        "height": 240,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "652acfc7-f734-4de4-a598-ec527d2ab20d",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -96
      ],
      "parameters": {
        "color": 6,
        "width": 432,
        "height": 240,
        "content": "**定义用于扫描的HTTP端口列表**"
      },
      "typeVersion": 1
    },
    {
      "id": "773abbaa-5b51-4914-aeb9-317f1ee55a92",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -96
      ],
      "parameters": {
        "color": 6,
        "width": 224,
        "height": 240,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "541c08d8-ff68-4110-8759-a9d95ee4415f",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -96
      ],
      "parameters": {
        "color": 6,
        "width": 224,
        "height": 240,
        "content": "**汇总端口扫描结果**"
      },
      "typeVersion": 1
    },
    {
      "id": "312c9a35-3cf4-4b38-be02-64482435589c",
      "name": "获取IP_信息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -176,
        -16
      ],
      "parameters": {
        "url": "=http://ip-api.com/json/{{ $json.IP }}",
        "options": {}
      },
      "typeVersion": 4.2
    }
  ],
  "active": true,
  "pinData": {
    "Google Sheets Trigger": [
      {
        "json": {
          "IP": "188.245.126.16",
          "ISP": "",
          "Lat": "",
          "Lon": "",
          "Org": "",
          "City": "",
          "Country": "",
          "Port_80": "",
          "Port_443": "",
          "PORT_3000": "",
          "Port_8000": "",
          "Port_8080": ""
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ee0b130b-725e-4809-bbfc-0bdfb962f936",
  "connections": {
    "5a0d22ee-2fb5-48e4-9000-e6799420bd8c": {
      "main": [
        [
          {
            "node": "fe67923f-d24f-404b-a16f-6d860a8531ac",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "312c9a35-3cf4-4b38-be02-64482435589c": {
      "main": [
        [
          {
            "node": "dc06f30b-8083-4e3b-8923-09f743ad7858",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dcf55b8f-76b2-4f9f-96c8-93dec9258495": {
      "main": [
        [
          {
            "node": "5a0d22ee-2fb5-48e4-9000-e6799420bd8c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fe67923f-d24f-404b-a16f-6d860a8531ac": {
      "main": [
        [
          {
            "node": "0b9969ad-6e89-4432-931d-311ea510fbb5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0b9969ad-6e89-4432-931d-311ea510fbb5": {
      "main": [
        [
          {
            "node": "8504d3c2-186c-4534-b3c9-b23641e2a47a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dc06f30b-8083-4e3b-8923-09f743ad7858": {
      "main": [
        [
          {
            "node": "dcf55b8f-76b2-4f9f-96c8-93dec9258495",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d48dee47-1fed-49fe-bf32-9b6b9982616e": {
      "main": [
        [
          {
            "node": "312c9a35-3cf4-4b38-be02-64482435589c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 安全运维, 多模态 AI

需要付费吗?

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

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

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

作者
IranServer.com

IranServer.com

@iranserver

Hosting, Virtual Server, Dedicated Server and Register Domain.

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34