nmap_script_scan
Execute NSE scripts to detect vulnerabilities, identify services, and analyze network security on specified targets.
Instructions
Run NSE (Nmap Scripting Engine) scripts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targets | Yes | ||
| scripts | No | default | |
| ports | No | common |
Implementation Reference
- server.py:163-176 (handler)The handler function for the nmap_script_scan tool. It takes targets, scripts, and ports as input, constructs Nmap arguments for NSE scripts, runs the command via run_nmap_command, and returns the formatted output or error.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)The @app.tool decorator that registers the nmap_script_scan function as a tool, providing the name and description. The input schema is inferred from the function's type annotations.@app.tool( name="nmap_script_scan", description="Run NSE (Nmap Scripting Engine) scripts" )
- server.py:163-167 (schema)The function signature defining the input parameters (targets: str, scripts: str='default', ports: str='common') and return type (str), which serves as the tool schema.async def nmap_script_scan( targets: str, scripts: str = "default", ports: str = "common" ) -> str: