File size: 731 Bytes
80a4a65
 
 
 
 
 
 
 
 
 
 
 
5d90003
 
80a4a65
5d90003
 
 
 
80a4a65
cb16781
80a4a65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Map module names to challenge types and back.

The frontend uses ``module`` to route a row to the right editor.
We keep two parallel maps and a single function for clarity.
"""

from .constants import WEB_EXPLOIT_MODULES


def challenge_type_for_module(module: str) -> str:
    """Return challenge type for a module name.

    Supports canonical challenge types AND topic names. New challenge
    types are wired by extending this function — no caller change required.
    """
    # Canonical challenge types
    if module in ("web-exploitation", "steganography"):
        return module
    # Topic names that map to web-exploitation
    if module in WEB_EXPLOIT_MODULES:
        return "web-exploitation"
    return "crypto"