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 ParameterOptimizer

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

Overview

Context-aware parameter optimizer that tunes security tool parameters based on detected technologies, system resources, and optimization profiles (stealth/normal/aggressive).

Description

The ParameterOptimizer class provides advanced parameter tuning for security tools. Its optimize_parameters_advanced method chains multiple optimization stages: base parameter extraction, technology detection via TechnologyDetector, resource-aware optimization via PerformanceMonitor, and profile-based optimization (stealth/normal/aggressive). It maintains per-tool optimization profiles for nmap, gobuster, and sqlmap with different parameter sets per profile.

Usage

  • Advanced optimization: Call optimize_parameters_advanced(tool, target_profile, context) for full intelligence pipeline
  • Profile selection: Set context["optimization_profile"] to "stealth", "normal", or "aggressive"
  • Integration: Called by IntelligentDecisionEngine.optimize_parameters when advanced optimizer is enabled

Code Reference

Source Location

  • Repository: HexStrike AI
  • File: hexstrike_server.py
  • Lines: L4635-4735 (ParameterOptimizer class)

Signature

class ParameterOptimizer:
    def __init__(self):
        self.tech_detector = TechnologyDetector()
        self.rate_limiter = RateLimitDetector()
        self.failure_recovery = FailureRecoverySystem()
        self.performance_monitor = PerformanceMonitor()
        self.optimization_profiles: Dict[str, Dict[str, Dict[str, Any]]]  # tool → profile → params

    def optimize_parameters_advanced(
        self,
        tool: str,
        target_profile: TargetProfile,
        context: Dict[str, Any] = None
    ) -> Dict[str, Any]:
        """Advanced parameter optimization with full intelligence."""

Import

from hexstrike_server import ParameterOptimizer

I/O Contract

Inputs

Name Type Required Description
tool str Yes Tool name to optimize
target_profile TargetProfile Yes Target profile from IntelligentDecisionEngine
context Dict[str, Any] No │ Additional context (headers, content, optimization_profile)

Outputs

Name Type Description
optimized_params Dict[str, Any] │ Tuned parameters with _optimization_metadata
_optimization_metadata Dict detected_technologies, resource_usage, optimization_profile, optimizations_applied

Usage Examples

Optimizing Nmap Parameters

from hexstrike_server import ParameterOptimizer, IntelligentDecisionEngine

engine = IntelligentDecisionEngine()
optimizer = ParameterOptimizer()

profile = engine.analyze_target("192.168.1.1")

# Optimize nmap for stealth
params = optimizer.optimize_parameters_advanced(
    tool="nmap",
    target_profile=profile,
    context={"optimization_profile": "stealth"}
)
print(f"Scan type: {params.get('scan_type')}")  # "-sS"
print(f"Timing: {params.get('timing')}")       # "-T2"
print(f"Profile: {params['_optimization_metadata']['optimization_profile']}")

Related Pages

Implements Principle

Requires Environment

Page Connections

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