Overview
AI-powered engine that analyzes targets, detects technologies, calculates attack surface scores, selects optimal tools by effectiveness ratings, and optimizes parameters for security scanning.
Description
The IntelligentDecisionEngine class is the core intelligence component of HexStrike. Its analyze_target method builds a TargetProfile by determining target type (web/API/network/cloud/binary), resolving DNS, detecting technologies and CMS, and calculating attack surface scores. select_optimal_tools filters tools by effectiveness ratings per target type and objective (comprehensive/quick/stealth). optimize_parameters delegates to ParameterOptimizer for context-aware parameter tuning.
Usage
- Target analysis: Call analyze_target(target) to build a complete TargetProfile
- Tool selection: Call select_optimal_tools(profile, objective) to get tools ranked by effectiveness
- Parameter optimization: Call optimize_parameters(tool, profile, context) for tuned tool settings
- Smart scan: POST to /api/intelligence/smart-scan to trigger the full pipeline with parallel execution
Code Reference
Source Location
- Repository: HexStrike AI
- File: hexstrike_server.py
- Lines: L572-1557 (IntelligentDecisionEngine class)
Signature
class IntelligentDecisionEngine:
def __init__(self):
self.tool_effectiveness: Dict[str, Dict[str, float]] # target_type → tool → rating
self.technology_signatures: Dict[str, List[str]]
self.attack_patterns: Dict[str, List[Dict[str, Any]]]
def analyze_target(self, target: str) -> TargetProfile:
"""Analyze target and create comprehensive profile."""
def _determine_target_type(self, target: str) -> TargetType:
"""Determine target type from URL/IP/domain patterns."""
def _detect_technologies(self, target: str) -> List[TechnologyStack]:
"""Detect technologies using heuristics."""
def _detect_cms(self, target: str) -> Optional[str]:
"""Detect CMS type (WordPress, Drupal, Joomla)."""
def _resolve_domain(self, target: str) -> List[str]:
"""Resolve domain to IP addresses."""
def _calculate_attack_surface(self, profile: TargetProfile) -> float:
"""Calculate attack surface score (0.0-10.0)."""
def _determine_risk_level(self, profile: TargetProfile) -> str:
"""Determine risk level: critical/high/medium/low/minimal."""
def _calculate_confidence(self, profile: TargetProfile) -> float:
"""Calculate confidence score (0.5-1.0)."""
def select_optimal_tools(self, profile: TargetProfile, objective: str = "comprehensive") -> List[str]:
"""Select optimal tools by effectiveness rating and objective."""
def optimize_parameters(self, tool: str, profile: TargetProfile, context: Dict[str, Any] = None) -> Dict[str, Any]:
"""Optimize tool parameters (delegates to ParameterOptimizer)."""
Import
from hexstrike_server import IntelligentDecisionEngine
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| target |
str |
Yes (analyze_target) |
URL, IP, or domain to analyze
|
| profile |
TargetProfile |
Yes (select/optimize) |
Target profile from analyze_target
|
| objective |
str |
No |
"comprehensive"/"quick"/"stealth" (default "comprehensive")
|
| tool |
str |
Yes (optimize_parameters) |
Tool name to optimize
|
Outputs
| Name |
Type |
Description
|
| TargetProfile |
TargetProfile |
Complete profile with type, tech, scores, risk, confidence
|
| selected tools |
List[str] |
Tool names ranked by effectiveness for the target type
|
| optimized params |
Dict[str, Any] |
Tuned parameters for the specified tool and target
|
Usage Examples
Full Intelligence Pipeline
from hexstrike_server import IntelligentDecisionEngine
engine = IntelligentDecisionEngine()
# Step 1: Analyze the target
profile = engine.analyze_target("https://example.com")
print(f"Type: {profile.target_type.value}")
print(f"Technologies: {[t.value for t in profile.technologies]}")
print(f"Attack surface: {profile.attack_surface_score}/10")
print(f"Risk level: {profile.risk_level}")
print(f"Confidence: {profile.confidence_score:.0%}")
# Step 2: Select optimal tools
tools = engine.select_optimal_tools(profile, objective="comprehensive")
print(f"Selected tools: {tools}")
# Step 3: Optimize parameters for each tool
for tool in tools:
params = engine.optimize_parameters(tool, profile)
print(f" {tool}: {params}")
Quick Scan Objective
# Select only top 3 tools for a fast scan
quick_tools = engine.select_optimal_tools(profile, objective="quick")
print(f"Quick scan tools: {quick_tools}")
Related Pages
Implements Principle
Uses Heuristic
Requires Environment