Skip to main content
Glama
SlanyCukr

Bug Bounty MCP Server

by SlanyCukr

nmap_advanced_scan

Execute comprehensive network reconnaissance scans to identify open ports, services, and vulnerabilities for security assessments and penetration testing.

Instructions

Execute advanced Nmap scan with comprehensive options for bug bounty hunting.

Args: target: Target IP or hostname scan_type: Scan technique (-sS, -sT, -sU, etc.) ports: Port specification timing: Timing template (-T0 to -T5) scripts: NSE scripts to run os_detection: Enable OS detection service_detection: Enable service version detection aggressive: Enable aggressive scan mode stealth: Enable stealth scan options additional_args: Additional arguments

Returns: Advanced scan results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
additional_argsNo
aggressiveNo
os_detectionNo
portsNo
scan_typeNo-sS
scriptsNo
service_detectionNo
stealthNo
targetYes
timingNo-T4

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary MCP handler and registration for the 'nmap_advanced_scan' tool. Defines the tool schema via function signature and proxies execution to the REST API backend.
    @mcp.tool()
    def nmap_advanced_scan(
        target: str,
        scan_type: str = "-sS",
        ports: str = "",
        timing: str = "-T4",
        scripts: str = "",
        os_detection: bool = False,
        service_detection: bool = True,
        aggressive: bool = False,
        stealth: bool = False,
        additional_args: str = "",
    ) -> dict[str, Any]:
        """Execute advanced Nmap scan with comprehensive options for bug bounty hunting.
    
        Args:
            target: Target IP or hostname
            scan_type: Scan technique (-sS, -sT, -sU, etc.)
            ports: Port specification
            timing: Timing template (-T0 to -T5)
            scripts: NSE scripts to run
            os_detection: Enable OS detection
            service_detection: Enable service version detection
            aggressive: Enable aggressive scan mode
            stealth: Enable stealth scan options
            additional_args: Additional arguments
    
        Returns:
            Advanced scan results
        """
        data = {
            "target": target,
            "scan_type": scan_type,
            "ports": ports,
            "timing": timing,
            "scripts": scripts,
            "os_detection": os_detection,
            "service_detection": service_detection,
            "aggressive": aggressive,
            "stealth": stealth,
            "additional_args": additional_args,
        }
    
        logger.info(f"🎯 Starting advanced Nmap scan on {target}")
        result = api_client.safe_post("api/nmap-advanced", data)
    
        if result.get("success"):
            logger.info(f"âś… Advanced Nmap scan completed on {target}")
        else:
            logger.error("❌ Advanced Nmap scan failed")
    
        return result
  • Backend REST API handler 'execute_nmap_advanced' for nmap-advanced tool, implementing the core Nmap execution, command construction, output parsing, and finding extraction.
    @tool(name="nmap-advanced", required_fields=["target"])
    def execute_nmap_advanced():
        """Execute advanced Nmap scans with clean structured output."""
        data = request.get_json()
        logger.info("Executing advanced Nmap scan on %s", data["target"])
    
        scan_type = data.get("scan_type", "-sS").strip()
        if scan_type == "-sS" and not os.geteuid() == 0:
            data["scan_type"] = "-sT"
            logger.info("Switched to -sT due to non-root privileges")
        command = _build_nmap_advanced_command(data)
        execution_result = execute_command(command, timeout=1800)
    
        if not execution_result["success"]:
            error_message = (
                execution_result.get("stderr")
                or execution_result.get("error")
                or "Nmap execution failed"
            )
            error_response, status_code = create_error_response(
                error_message,
                stage="exec",
                details={
                    "return_code": execution_result.get("return_code"),
                    "command": execution_result.get("command", command),
                },
                status_code=500,
            )
            return jsonify(error_response), status_code
    
        stdout = execution_result.get("stdout", "")
        with open("/tmp/nmap_advanced_raw_output.log", "w") as f:
            f.write(stdout)
        findings, duplicates = _collect_findings(stdout)
    
        stats = create_stats(
            len(findings),
            duplicates,
            len(stdout.encode("utf-8")),
        )
    
        return {
            "findings": findings,
            "stats": stats,
        }
  • Helper function to construct the Nmap command line based on advanced scan parameters.
    def _build_nmap_advanced_command(params: dict[str, Any]) -> str:
        cmd_parts: list[str] = ["nmap"]
    
        scan_type = params.get("scan_type", "-sS").strip()
        if scan_type:
            cmd_parts.extend(scan_type.split())
    
        ports = params.get("ports", "").strip()
        if ports:
            cmd_parts.extend(["-p", ports])
    
        if params.get("stealth", False):
            cmd_parts.extend(["-T2", "-f", "--mtu", "24"])
        else:
            timing = params.get("timing", "T4").lstrip("-")
            if timing:
                cmd_parts.append(f"-{timing}")
    
        if params.get("os_detection", False):
            cmd_parts.append("-O")
    
        if params.get("service_detection", True) or params.get("version_detection", False):
            cmd_parts.append("-sV")
    
        if params.get("aggressive", False):
            cmd_parts.append("-A")
    
        script_param = params.get("nse_scripts") or params.get("scripts")
        if script_param:
            cmd_parts.extend(["--script", script_param])
        elif not params.get("aggressive", False):
            cmd_parts.extend(["--script", "default,discovery,safe"])
    
        cmd_parts.extend(["-oX", "-"])
    
        additional_args = params.get("additional_args", "")
        if additional_args:
            cmd_parts.extend(shlex.split(additional_args))
    
        cmd_parts.append(params["target"])
    
        return " ".join(shlex.quote(part) for part in cmd_parts)
  • Helper function to parse Nmap XML output, deduplicate findings, and standardize evidence and tags.
    def _collect_findings(stdout: str) -> tuple[list[dict[str, Any]], int]:
        findings = parse_nmap_output(stdout)
    
        duplicates = 0
        unique: list[dict[str, Any]] = []
        seen: set[tuple[str, Any, Any]] = set()
    
        for finding in findings:
            if finding["type"] == "port":
                key = (
                    finding["target"],
                    finding["evidence"].get("port"),
                    finding["evidence"].get("protocol"),
                )
            else:
                key = (finding["type"], finding["target"], None)
    
            if key in seen:
                duplicates += 1
                continue
    
            seen.add(key)
    
            evidence = finding.get("evidence", {})
            evidence["discovered_by"] = "nmap-advanced"
            finding["evidence"] = evidence
    
            tags = finding.get("tags", [])
            if "nmap-advanced" not in tags:
                tags.append("nmap-advanced")
                finding["tags"] = tags
    
            unique.append(finding)
    
        return unique, duplicates
  • Import registration that triggers auto-registration of the nmap_advanced tool handler via the @tool decorator.
    from .nmap import nmap as nmap
    from .nmap_advanced import nmap_advanced as nmap_advanced
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'advanced Nmap scan' and 'comprehensive options,' but lacks critical details such as whether this is a read-only or destructive operation, potential rate limits, authentication needs, or what 'advanced' entails beyond parameter listing. This is inadequate for a tool with 10 parameters and no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by organized 'Args' and 'Returns' sections. It's appropriately sized for a tool with many parameters, though the 'Args' section is somewhat verbose due to listing all parameters—this is necessary given the context, so it earns a high score for efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (10 parameters, no annotations, but with an output schema), the description is moderately complete. It covers the purpose and parameters adequately but lacks behavioral transparency and usage guidelines. The presence of an output schema means the description doesn't need to detail return values, but other gaps remain for a tool of this scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description includes an 'Args' section that lists all 10 parameters with brief explanations (e.g., 'Target IP or hostname' for 'target'), adding meaningful context beyond the input schema's 0% description coverage. This compensates well for the schema's lack of descriptions, though some explanations could be more detailed (e.g., 'Scan technique (-sS, -sT, -sU, etc.)' is helpful but not exhaustive).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Execute advanced Nmap scan with comprehensive options for bug bounty hunting,' which specifies both the verb ('execute advanced Nmap scan') and the resource ('target' implied). However, it doesn't explicitly differentiate from its sibling 'nmap_scan' (also in the sibling list), which would be needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance by mentioning 'bug bounty hunting' as a context, but it doesn't specify when to use this tool versus alternatives like 'nmap_scan' or other scanning tools in the sibling list. No explicit when-not-to-use or prerequisite information is included.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SlanyCukr/bugbounty-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server