nmap_ping_scan
Discover live hosts on a network by performing a ping scan with this tool, designed to identify active devices efficiently using specified targets and scan types.
Instructions
Perform ping scan to discover live hosts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ping_type | No | both | |
| targets | Yes |
Implementation Reference
- server.py:221-224 (registration)The @app.tool decorator registers the nmap_ping_scan tool with FastMCP, specifying its name and description.@app.tool( name="nmap_ping_scan", description="Perform ping scan to discover live hosts" )
- server.py:225-242 (handler)The handler function executes the ping scan logic: constructs Nmap arguments based on ping_type (icmp/tcp/both), runs the command, and returns formatted output or error.async def nmap_ping_scan( targets: str, ping_type: str = "both" ) -> str: """Perform ping scan to discover live hosts.""" if ping_type == "icmp": args = ["-sn", targets] elif ping_type == "tcp": args = ["-PS", targets] else: # both args = ["-sn", "-PS", targets] result = run_nmap_command(args) if result["success"]: return f"Ping scan completed:\n\n{result['stdout']}" else: return f"Ping scan failed:\n\n{result['stderr']}"