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 CTFWorkflowManager

From Leeroopedia
Knowledge Sources
Domains CTF, Workflow_Orchestration, Security
Last Updated 2026-10-10 00:00 GMT

Overview

Workflow manager that generates category-specific CTF solving workflows with strategies, time estimates, parallel task groups, and resource requirements.

Description

The CTFWorkflowManager class creates solving workflows from a CTFChallenge. It maintains per-category tool arsenals (category_tools), solving strategies (solving_strategies), and methods for time estimation, workflow construction, and parallel task identification. The create_ctf_challenge_workflow method orchestrates all components to produce a complete workflow dict with tools, strategies, estimated_time, success_probability, workflow_steps, parallel_tasks, and resource requirements.

Usage

  • Generate a solving workflow: Call create_ctf_challenge_workflow(challenge) to get the complete workflow for a CTF challenge
  • Estimate time and success: The workflow includes estimated_time (seconds) and success_probability (0.25-0.95)
  • Identify parallel tasks: The workflow includes task groups with max_concurrent limits for parallel execution

Code Reference

Source Location

  • Repository: HexStrike AI
  • File: hexstrike_server.py
  • Lines: L2795-3491 (CTFWorkflowManager class)

Signature

class CTFWorkflowManager:
    def __init__(self):
        self.category_tools: Dict[str, Dict[str, List[str]]]  # 7 categories
        self.solving_strategies: Dict[str, List[Dict[str, str]]]  # 7 categories

    def create_ctf_challenge_workflow(self, challenge: CTFChallenge) -> Dict[str, Any]:
        """Create comprehensive workflow for a CTF challenge."""

    def _analyze_description_complexity(self, description: str) -> float:
        """Analyze challenge description complexity (0.0-1.0) for time adjustment."""

    def _create_advanced_category_workflow(self, challenge: CTFChallenge) -> List[Dict[str, Any]]:
        """Create 6-8 step workflow per category with parallel flags and tools."""

    def _identify_parallel_tasks(self, category: str) -> List[Dict[str, Any]]:
        """Identify task groups that can run in parallel with max_concurrent limits."""

    def _select_tools_for_challenge(self, challenge: CTFChallenge, category_tools: Dict) -> List[str]:
        """Select tools based on challenge description keyword matching."""

    def _calculate_resource_requirements(self, challenge: CTFChallenge) -> Dict[str, Any]:
        """Calculate CPU, memory, disk requirements."""

Import

from hexstrike_server import CTFWorkflowManager

I/O Contract

Inputs

Name Type Required Description
challenge CTFChallenge Yes Challenge with category, description, difficulty

Outputs

Name Type Description
workflow Dict[str, Any] Contains tools, strategies, estimated_time, success_probability, workflow_steps, parallel_tasks, resource_requirements
estimated_time int Seconds (base_time × category_multiplier × complexity_multiplier × 60)
success_probability float 0.25-0.95 based on difficulty + tool availability bonus

Usage Examples

Generate a CTF Solving Workflow

from hexstrike_server import CTFChallenge, CTFWorkflowManager

challenge = CTFChallenge(
    name="Crypto Challenge",
    category="crypto",
    description="Decrypt an RSA-encrypted message with a weak key. The public key is provided.",
    difficulty="medium",
    points=300
)

manager = CTFWorkflowManager()
workflow = manager.create_ctf_challenge_workflow(challenge)

print(f"Estimated time: {workflow['estimated_time']}s")
print(f"Success probability: {workflow['success_probability']:.0%}")
print(f"Tools: {workflow['tools']}")
print(f"Strategies: {[s['strategy'] for s in workflow['strategies']]}")
print(f"Workflow steps: {len(workflow['workflow_steps'])}")

# Show parallel task groups
for group in workflow['parallel_tasks']:
    print(f"  Parallel: {group['task_group']} ({group['max_concurrent']} concurrent)")

Related Pages

Implements Principle

Uses Heuristic

Requires Environment

Page Connections

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