Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0x4m4 Hexstrike ai intelligent smart scan

From Leeroopedia
Knowledge Sources
Domains Intelligence, Parallel_Execution, Security
Last Updated 2026-10-10 00:00 GMT

Overview

Flask endpoint that orchestrates the full intelligent scan pipeline: target analysis, tool selection, parameter optimization, and parallel multi-tool execution with combined vulnerability reporting.

Description

The intelligent_smart_scan Flask endpoint at /api/intelligence/smart-scan is the culmination of the Intelligent Tool Selection workflow. It calls analyze_target to build a profile, select_optimal_tools to choose tools by effectiveness, optimize_parameters for each tool, then executes all tools in parallel using ThreadPoolExecutor. The tool_execution_map maps 16 tool names to their execution functions. Results include per-tool status, vulnerability counts, execution time, and combined output.

Usage

POST to /api/intelligence/smart-scan with a target to trigger the full pipeline:

  • Comprehensive scan: Default objective selects all tools with effectiveness > 0.7
  • Quick scan: Set objective="quick" for top 3 tools only
  • Limited tools: Set max_tools to cap the number of parallel tools

Code Reference

Source Location

  • Repository: HexStrike AI
  • File: hexstrike_server.py
  • Lines: L9672-9822 (endpoint and execute_single_tool inner function)

Signature

@app.route("/api/intelligence/smart-scan", methods=["POST"])
def intelligent_smart_scan():
    """
    Execute an intelligent scan using AI-driven tool selection and
    parameter optimization with parallel execution.

    Expects JSON body:
        target: str - scan target (required)
        objective: str - "comprehensive"/"quick"/"stealth" (default "comprehensive")
        max_tools: int - max tools to execute (default 5)

    Returns JSON with scan_results containing target_profile, tools_executed,
    total_vulnerabilities, execution_summary, and combined_output.
    """
    # Pipeline: analyze_target → select_optimal_tools → optimize_parameters → parallel execute
    # Uses ThreadPoolExecutor with max_workers=min(len(selected_tools), 5)
    # tool_execution_map supports: nmap, gobuster, nuclei, nikto, sqlmap, ffuf,
    #   feroxbuster, katana, httpx, wpscan, dirsearch, arjun, paramspider, dalfox, amass, subfinder

Import

# This is a Flask endpoint in hexstrike_server.py
# Call via HTTP POST to /api/intelligence/smart-scan

I/O Contract

Inputs

Name Type Required Description
target str Yes URL, IP, or domain to scan
objective str No "comprehensive"/"quick"/"stealth" (default "comprehensive")
max_tools int No Maximum tools to execute (default 5)

Outputs

Name Type Description
success bool Whether the scan pipeline completed
scan_results.target str Scanned target
scan_results.target_profile Dict Target analysis profile
scan_results.tools_executed List[Dict] Per-tool results with status, output, vulnerabilities
scan_results.total_vulnerabilities int Sum of vulnerability indicators across all tools
scan_results.execution_summary Dict total_tools, successful_tools, failed_tools, success_rate
scan_results.combined_output str Concatenated stdout from all tools

Usage Examples

Trigger a Smart Scan

import requests

response = requests.post("http://localhost:5000/api/intelligence/smart-scan", json={
    "target": "https://example.com",
    "objective": "comprehensive",
    "max_tools": 5
})

result = response.json()
scan = result["scan_results"]

print(f"Target profile: {scan['target_profile']['target_type']}")
print(f"Tools executed: {len(scan['tools_executed'])}")
print(f"Vulnerabilities: {scan['total_vulnerabilities']}")
print(f"Success rate: {scan['execution_summary']['success_rate']:.0f}%")

for tool_result in scan["tools_executed"]:
    status = "✅" if tool_result["success"] else "❌"
    print(f"  {status} {tool_result['tool']}: {tool_result.get('vulnerabilities_found', 0)} vulns")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment