docs: update architecture and add tests for flag regex generation

This commit is contained in:
venus
2026-07-17 02:06:34 -05:00
parent c069e51263
commit 9e91f8ef0f
3 changed files with 157 additions and 0 deletions

View File

@@ -39,10 +39,13 @@ Provides helper functions for filesystem management and configuration parsing:
* `write_config(data, path)`: Serializes/updates a dictionary to a TOML file.
* `active_categories(path)`: Iterates over a competition path to return all active categories.
* `active_competitions(dir)`: Scans the base directory for active competitions, skipping designated helper directories (like `tools`).
* `suggest_patterns(flag)`: Analyzes a provided sample flag string and generates a prioritized, deduplicated list of regular expression pattern candidates (ranging from specific to general).
### C. Commands ([commands.py](file:///home/venus/code/ctf/src/ctf/commands.py))
Houses the logic for generic CLI context and active competition commands:
* `Set_Challenge(comp, chal, setDirectory)`: Sets the current active challenge/competition context. *(Note: Currently has a `NameError` due to reference to an undefined `state` object.)*
* `set-flag-format (pattern)`: Sets the flag regex format in configuration. Supports optional `PATTERN` positional argument or an interactive choice using `-o`/`--original` which takes a sample flag and prompts the user to select from suggested regex patterns.
### D. Forensics ([forensics.py](file:///home/venus/code/ctf/src/ctf/forensics.py))
Implements specialized forensic inspection utilities registered as a nested subgroup under the CLI: