Implementation:0x4m4 Hexstrike ai CTFChallenge
| Knowledge Sources | |
|---|---|
| Domains | CTF, Security |
| Last Updated | 2026-10-10 00:00 GMT |
Overview
Dataclass that captures CTF challenge metadata: name, category, difficulty, points, files, and hints for workflow generation.
Description
The CTFChallenge dataclass represents a CTF challenge with its category (web, crypto, pwn, forensics, rev, misc, osint), difficulty level, point value, description, attached files, and hints. It is passed to CTFWorkflowManager to generate solving workflows and to CTFChallengeAutomator for automated solving attempts.
Usage
Create a CTFChallenge to initiate the CTF solving pipeline:
- Web challenges: Set category="web" with the challenge URL
- Crypto challenges: Set category="crypto" with cipher/hash details in description
- Binary challenges: Set category="pwn" or "rev" with file paths
Code Reference
Source Location
- Repository: HexStrike AI
- File: hexstrike_server.py
- Lines: L2784-2793
Signature
@dataclass
class CTFChallenge:
"""CTF challenge information"""
name: str
category: str # web, crypto, pwn, forensics, rev, misc, osint
description: str
points: int = 0
difficulty: str = "unknown" # easy, medium, hard, insane
files: List[str] = field(default_factory=list)
url: str = ""
hints: List[str] = field(default_factory=list)
Import
from hexstrike_server import CTFChallenge
I/O Contract
Inputs (Constructor)
| Name | Type | Required | Description |
|---|---|---|---|
| name | str | Yes | Challenge name |
| category | str | Yes | One of: web, crypto, pwn, forensics, rev, misc, osint |
| description | str | Yes | Challenge description text (used for keyword-based tool selection) |
| points | int | No | Point value (default 0) |
| difficulty | str | No | easy/medium/hard/insane/unknown (default "unknown") |
| files | List[str] | No | Attached file paths |
| url | str | No | Challenge URL |
| hints | List[str] | No | Provided hints |
Outputs
| Name | Type | Description |
|---|---|---|
| instance | CTFChallenge | Dataclass passed to CTFWorkflowManager and CTFChallengeAutomator |
Usage Examples
Creating a Web CTF Challenge
from hexstrike_server import CTFChallenge
challenge = CTFChallenge(
name="SQL Injection Challenge",
category="web",
description="Find the admin flag by exploiting a SQL injection vulnerability in the login form.",
points=200,
difficulty="medium",
url="http://challenge.ctf.example.com",
hints=["Look at the login form parameters"]
)