diff --git a/workflows/Automated DNS Records Lookup for Subdomains with HackerTarget API and Gmail Reports-6355/automated_dns_records_lookup_for_subdomains_with_hackertarget_api_and_gmail_reports.json b/workflows/Automated DNS Records Lookup for Subdomains with HackerTarget API and Gmail Reports-6355/automated_dns_records_lookup_for_subdomains_with_hackertarget_api_and_gmail_reports.json new file mode 100644 index 000000000..381992bdb --- /dev/null +++ b/workflows/Automated DNS Records Lookup for Subdomains with HackerTarget API and Gmail Reports-6355/automated_dns_records_lookup_for_subdomains_with_hackertarget_api_and_gmail_reports.json @@ -0,0 +1 @@ +{"id":"RNNkYFKdsO7f3dSi","meta":{"instanceId":"6feff41aadeb8409737e26476f9d0a45f95eec6a9c16afff8ef87a662455b6df","templateCredsSetupCompleted":true},"name":"EnumX: Auto DNS Lookup for Subdomains with Markdown Export","tags":[{"id":"gGA3sGFynnEJEGfZ","name":"Enumeration Engine","createdAt":"2025-07-24T00:23:37.375Z","updatedAt":"2025-07-24T00:23:37.375Z"}],"nodes":[{"id":"18df8e48-3d79-413e-bac0-a08fdd167866","name":"When clicking βExecute workflowβ","type":"n8n-nodes-base.manualTrigger","position":[-2120,20],"parameters":{},"typeVersion":1},{"id":"2ec4a837-11f3-4af3-ac37-345ce4fa9947","name":"π Target Domain","type":"n8n-nodes-base.set","position":[-1920,20],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0383ffe1-377f-48ad-a476-8e67eabdfefa","name":"domain","type":"string","value":"example.com"}]}},"typeVersion":3.4},{"id":"8d9989c2-4f04-4a12-8eae-04a89152bae2","name":"π‘ Subdomain Enum","type":"n8n-nodes-base.httpRequest","position":[-1700,20],"parameters":{"url":"=https://api.hackertarget.com/hostsearch/?q={{$json[\"domain\"]}}","options":{"response":{"response":{"responseFormat":"text","outputPropertyName":""}}}},"typeVersion":4.2},{"id":"1b26f151-215a-4898-b5a0-5e6f0ed2d39d","name":"π§ Parse Subdomains","type":"n8n-nodes-base.code","position":[-1480,20],"parameters":{"jsCode":"// Get the first item (raw output from Subdomain Enum)\nconst item = $items(\"π‘ Subdomain Enum\")[0];\nconst rawText = Object.values(item.json)[0]; // the unnamed field\n\nconst lines = rawText.split(\"\\n\");\n\nreturn lines\n .filter(line => line.trim() !== \"\")\n .map(line => {\n const [subdomain, ip] = line.split(\",\");\n return { json: { subdomain, ip } };\n });"},"typeVersion":2},{"id":"e9c560c3-4cb9-42f2-9cac-000f71c700d6","name":"π DNS Records","type":"n8n-nodes-base.httpRequest","position":[-1240,160],"parameters":{"url":"=https://api.hackertarget.com/dnslookup/?q={{$json[\"subdomain\"]}}","options":{"response":{"response":{"responseFormat":"text","outputPropertyName":"dns"}}}},"typeVersion":4.2,"alwaysOutputData":true},{"id":"3e10f83e-3ec6-41fe-8a9f-c2a62d077f72","name":"π Format DNS Markdown","type":"n8n-nodes-base.code","position":[-640,40],"parameters":{"mode":"runOnceForEachItem","jsCode":"const input = $input.item.json;\nconst subdomain = input.subdomain || \"unknown.subdomain\";\n\n// Explicitly access each DNS record type\nconst dnsRecords = {\n A: input.a || [],\n AAAA: input.aaaa || [],\n CNAME: input.cname || [],\n TXT: input.txt || [],\n MX: input.mx || [],\n NS: input.ns || [],\n SOA: input.soa || []\n};\n\nlet markdown = `### DNS Records for: ${subdomain}\\n\\n`;\n\nfor (const [type, records] of Object.entries(dnsRecords)) {\n if (Array.isArray(records) && records.length > 0) {\n const formatted = records.map(r => `- ${r}`).join('\\n');\n markdown += `**${type}**:\\n${formatted}\\n\\n`;\n } else {\n markdown += `**${type}**:\\n- No records found.\\n\\n`;\n }\n}\n\nreturn {\n json: {\n subdomain,\n dns_markdown: markdown.trim()\n }\n};\n"},"typeVersion":2},{"id":"c25357fb-a67b-49dc-8614-28d2d0760884","name":"π Merge DNS + Subdomain","type":"n8n-nodes-base.merge","position":[-840,40],"parameters":{"mode":"combine","options":{},"joinMode":"keepEverything","fieldsToMatchString":"subdomain"},"typeVersion":3.2},{"id":"c55d3e8f-0d07-4e57-a2e7-6658f74edba7","name":"π§ Parse DNS Records","type":"n8n-nodes-base.code","position":[-1020,160],"parameters":{"jsCode":"// Get raw text from DNS Lookup node\nconst dnsText = $json.dns || \"No data\";\n\n// Prepare output object\nconst recordTypes = ['A', 'AAAA', 'CNAME', 'TXT', 'MX', 'NS', 'SOA'];\nconst result = {\n subdomain: $json.subdomain || \"unknown.subdomain\"\n};\n\n// Initialize arrays for each type\nfor (const type of recordTypes) {\n result[type.toLowerCase()] = [];\n}\n\n// Parse each line\ndnsText.split('\\n').forEach(line => {\n const match = line.match(/^(\\w+)\\s*:\\s*(.*)$/);\n if (match) {\n const type = match[1].toUpperCase();\n const value = match[2].trim();\n if (recordTypes.includes(type)) {\n result[type.toLowerCase()].push(value);\n }\n }\n});\n\n// If no values found, insert \"No records found\"\nfor (const type of recordTypes) {\n if (result[type.toLowerCase()].length === 0) {\n result[type.toLowerCase()].push(\"No records found.\");\n }\n}\n\nreturn [ { json: result } ];"},"typeVersion":2},{"id":"b4878f12-57b1-48ed-8662-d84227209abe","name":"Gmail","type":"n8n-nodes-base.gmail","position":[-240,40],"webhookId":"e825199e-fc30-4a63-8b93-8a874b7755a7","parameters":{"sendTo":"security-team@example.com","message":"=
{{$json[\"full_report\"]}}\nβ
This email was sent automatically with n8n
https://n8n.io