Overview
Tool manager for CTF challenges that maps 100+ external tools across 7 categories to challenge descriptions via keyword matching, with pre-configured command templates.
Description
The CTFToolManager class maintains a tool_commands dictionary of 100+ security tools with their default CLI invocations, organized by CTF category (web, crypto, pwn, forensics, rev, OSINT, misc). The suggest_tools_for_challenge method performs keyword-based matching against the challenge description to select relevant tools. It also provides get_tool_command to retrieve the CLI template and get_category_tools to list all tools for a category.
Usage
- Tool suggestion: Call suggest_tools_for_challenge(description, category) to get tools matching challenge keywords
- Command retrieval: Call get_tool_command(tool_name, target) to get the CLI command string for a tool
- Category listing: Call get_category_tools(category) to list all tools in a category
Code Reference
Source Location
- Repository: HexStrike AI
- File: hexstrike_server.py
- Lines: L3492-3849 (CTFToolManager class)
Signature
class CTFToolManager:
def __init__(self):
self.tool_commands: Dict[str, str] # 100+ tool name → CLI command templates
self.tool_categories: Dict[str, List[str]] # category → tool name list
def suggest_tools_for_challenge(self, challenge_description: str, category: str) -> List[str]:
"""Suggest optimal tools based on challenge description keywords and category."""
def get_tool_command(self, tool_name: str, target: str = "") -> str:
"""Get the CLI command template for a tool, formatted with target."""
def get_category_tools(self, category: str) -> Dict[str, List[str]]:
"""Get all tools organized by subcategory for a CTF category."""
Import
from hexstrike_server import CTFToolManager
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| challenge_description |
str |
Yes |
Challenge text for keyword matching
|
| category |
str |
Yes |
CTF category (web/crypto/pwn/forensics/rev/misc/osint)
|
| tool_name |
str |
Yes (get_tool_command) |
Tool name to look up
|
| target |
str |
No (get_tool_command) |
Target to format into command template
|
Outputs
| Name |
Type |
Description
|
| suggested tools |
List[str] |
Tool names matched to description keywords (deduplicated)
|
| tool command |
str |
CLI command string with target substituted
|
Usage Examples
Suggesting Tools for a Crypto Challenge
from hexstrike_server import CTFToolManager
ctf_tools = CTFToolManager()
# Suggest tools based on challenge description
tools = ctf_tools.suggest_tools_for_challenge(
challenge_description="Decrypt an RSA-encrypted message. The public key and ciphertext are provided.",
category="crypto"
)
print(f"Suggested tools: {tools}")
# Output: ['rsatool', 'factordb', 'yafu', 'cipher-identifier', 'frequency-analysis']
# Get the CLI command for a suggested tool
command = ctf_tools.get_tool_command("hashcat", "target_hash.txt")
print(f"Command: {command}")
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.