AutomationFlowsAI & RAG › Pentest RAG Graph Query

Pentest RAG Graph Query

Pentest RAG Graph Query. Uses httpRequest. Webhook trigger; 4 nodes.

Webhook trigger★★★★☆ complexity4 nodesHTTP Request
AI & RAG Trigger: Webhook Nodes: 4 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Pentest RAG Graph Query",
  "description": null,
  "active": true,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "path": "rag-graph",
        "httpMethod": "POST",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "node-webhook-rag-graph",
      "name": "Graph query webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "\nconst body = $input.first().json.body;\nconst type = body.query_type;\nlet cypher = '';\nlet params = {};\n\nswitch (type) {\n  case 'plugin_cves':\n    cypher = `\n      MATCH (p:Plugin) WHERE p.navn = $plugin_navn\n      OPTIONAL MATCH (p)-[:HAR_S\u00c5RBARHED]->(c:CVE)\n      OPTIONAL MATCH (s:Site)-[:K\u00d8RER_PLUGIN]->(p)\n      OPTIONAL MATCH (s)-[:HAR_FUND]->(f:Fund)-[:RELATERET_CVE]->(c)\n      OPTIONAL MATCH (f)-[:FUNDET_MED]->(t:Teknik)\n      RETURN p.navn AS plugin, p.version AS version,\n        collect(DISTINCT {cve: c.id, cvss: c.cvss, site: s.dom\u00e6ne,\n          fund: f.titel, teknik: t.kommando}) AS resultater`;\n    params = { plugin_navn: body.plugin_navn || '' };\n    break;\n\n  case 'site_history':\n    cypher = `\n      MATCH (s:Site {dom\u00e6ne: $domaene})\n      OPTIONAL MATCH (k:Kunde)-[:EJER]->(s)\n      OPTIONAL MATCH (s)-[:K\u00d8RER_PLUGIN]->(p:Plugin)\n      OPTIONAL MATCH (s)-[:HAR_FUND]->(f:Fund)\n      OPTIONAL MATCH (f)-[:FUNDET_MED]->(t:Teknik)\n      OPTIONAL MATCH (f)-[:RELATERET_CVE]->(c:CVE)\n      RETURN s.dom\u00e6ne AS domaene, s.cms AS cms, s.version AS version,\n        k.navn AS kunde,\n        collect(DISTINCT {plugin: p.navn, version: p.version}) AS plugins,\n        collect(DISTINCT {titel: f.titel, cvss: f.cvss,\n          teknik: t.kommando, cve: c.id}) AS fund`;\n    params = { domaene: body.domaene || body.dom\u00e6ne || '' };\n    break;\n\n  case 'teknik_for_fund':\n    cypher = `\n      MATCH (f:Fund)-[:FUNDET_MED]->(t:Teknik)\n      WHERE f.titel CONTAINS $fund_type OR f.beskrivelse CONTAINS $fund_type\n      RETURN t.navn AS teknik, t.kommando AS kommando, t.v\u00e6rkt\u00f8j AS vaerktoj,\n        t.beskrivelse AS beskrivelse,\n        collect(DISTINCT {fund: f.titel, cvss: f.cvss}) AS brugt_til\n      ORDER BY size(collect(f)) DESC`;\n    params = { fund_type: body.fund_type || '' };\n    break;\n\n  case 'related_sites':\n    cypher = `\n      MATCH (s1:Site {dom\u00e6ne: $domaene})-[:K\u00d8RER_PLUGIN]->(p:Plugin)<-[:K\u00d8RER_PLUGIN]-(s2:Site)\n      WHERE s1 <> s2\n      OPTIONAL MATCH (s2)-[:HAR_FUND]->(f:Fund)\n      RETURN p.navn AS faelles_plugin, s2.dom\u00e6ne AS relateret_site,\n        collect(DISTINCT {fund: f.titel, cvss: f.cvss}) AS fund_paa_relateret`;\n    params = { domaene: body.domaene || body.dom\u00e6ne || '' };\n    break;\n\n  default:\n    return [{ json: { error: 'Ukendt query_type. Brug: plugin_cves, site_history, teknik_for_fund, related_sites' }}];\n}\n\nreturn [{ json: { cypher, params, query_type: type }}];\n"
      },
      "id": "node-byg-cypher",
      "name": "Byg Cypher",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://neo4j:7474/db/neo4j/tx/commit",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"statements\": [{\"statement\": {{ JSON.stringify($json.cypher) }}, \"parameters\": {{ JSON.stringify($json.params) }}}]}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "id": "node-neo4j-graph-query",
      "name": "Neo4j graph query",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        680,
        300
      ],
      "credentials": {
        "httpBasicAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "\nconst input = $input.first().json;\nconst results = input.results?.[0];\n\nif (!results?.data?.length) {\n  return [{ json: { svar: \"Ingen data i grafen.\", data: [] }}];\n}\n\nconst columns = results.columns;\nconst rows = results.data.map(r => {\n  const obj = {};\n  columns.forEach((col, i) => { obj[col] = r.row[i]; });\n  return obj;\n});\n\nreturn [{ json: { svar: `${rows.length} resultat(er) via graph.`, data: rows, columns }}];\n"
      },
      "id": "node-formater-graph-resultat",
      "name": "Formater graph resultat",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "Graph query webhook": {
      "main": [
        [
          {
            "node": "Byg Cypher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Byg Cypher": {
      "main": [
        [
          {
            "node": "Neo4j graph query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Neo4j graph query": {
      "main": [
        [
          {
            "node": "Formater graph resultat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "activeVersionId": "d5e94f5b-dda3-4e7d-8935-d7b811177ff1",
  "versionCounter": 6,
  "triggerCount": 1,
  "tags": [],
  "shared": [
    {
      "updatedAt": "2026-05-23T10:18:37.288Z",
      "createdAt": "2026-05-23T10:18:37.288Z",
      "role": "workflow:owner",
      "workflowId": "mI0FAP0BPJ79siZQ",
      "projectId": "mBwAmYhJNV3JFVeG",
      "project": {
        "updatedAt": "2026-05-23T10:16:37.814Z",
        "createdAt": "2026-05-23T10:14:57.720Z",
        "id": "mBwAmYhJNV3JFVeG",
        "name": "hannibal u-w <hannibal@ussing.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "creatorId": "ddbee286-2878-4f4d-873f-e6c8d1e1c77f"
      }
    }
  ],
  "versionMetadata": {
    "name": null,
    "description": null
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Pentest RAG Graph Query. Uses httpRequest. Webhook trigger; 4 nodes.

Source: https://github.com/Huw02/pentesting-bot/blob/bacf3595503962a20c03104d80ce1b5256601bb8/n8n-workflows/rag-graph-query.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automates end-to-end social media publishing powered by Late API. It generates text content with Google Gemini, creates branded visuals with Kie.ai, uploads media to Late, and publishes

HTTP Request
AI & RAG

This workflow is perfect for app developers, SaaS founders, and mobile growth teams who need constant UGC-style video ads without hiring creators or agencies. If you're spending $500+ per creator and

HTTP Request, Google Drive
AI & RAG

AI Background Generation with Nano Banana (Gemini Image). Uses httpRequest, googleDrive. Webhook trigger; 35 nodes.

HTTP Request, Google Drive
AI & RAG

This template is for developers, teams, and automation enthusiasts who want a private, PIN-protected Telegram chatbot that answers questions from their own documents — without relying on external AI A

Postgres, Telegram, HTTP Request +2
AI & RAG

Elevate your digital presence with high-fidelity cinematic video automation. This workflow orchestrates the complex, asynchronous rendering process of OpenAI Sora—transforming static product images or

HTTP Request, N8N Nodes Uploadtourl