nmap_script_scan
Execute NSE scripts to perform targeted network scans, detect services, and identify vulnerabilities using the Nmap Scripting Engine via the Nmap MCP Server.
Instructions
Run NSE (Nmap Scripting Engine) scripts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ports | No | common | |
| scripts | No | default | |
| targets | Yes |
Implementation Reference
- server.py:163-176 (handler)The handler function for the nmap_script_scan tool. It constructs Nmap arguments using the provided scripts, ports, and targets, executes the scan via run_nmap_command, and returns formatted stdout or stderr.async def nmap_script_scan( targets: str, scripts: str = "default", ports: str = "common" ) -> str: """Run NSE (Nmap Scripting Engine) scripts.""" args = [f"--script={scripts}", "-p", ports, targets] result = run_nmap_command(args) if result["success"]: return f"NSE script scan completed:\n\n{result['stdout']}" else: return f"NSE script scan failed:\n\n{result['stderr']}"
- server.py:159-162 (registration)Registration of the nmap_script_scan tool using the @app.tool decorator from FastMCP, specifying the name and description.@app.tool( name="nmap_script_scan", description="Run NSE (Nmap Scripting Engine) scripts" )