ctfsolver.managers.manager_crypto¶
manager_crypto.py
This module provides cryptographic utility functions for CTF (Capture The Flag) challenges, including XOR encryption, Base64 decoding, and regular expression-based extraction of flags and encoded strings from text.
- Classes:
ManagerCrypto: A class containing methods for cryptographic operations and pattern matching.
- Typical usage example:
crypto = ManagerCrypto() decoded = crypto.decode_base64(encoded_text) flags = crypto.re_match_flag(text, “FLAG”)
- initializing_all_ancestors(*args, **kwargs)[source]¶
Initializes all ancestors of the class (placeholder).
- xor(text
str, key: str) -> str: XORs the input text with the provided key.
- decode_base64(text
str) -> str: Decodes a Base64-encoded string.
- re_match_base64_string(text
str, strict=False) -> list[str]: Finds Base64 strings in the input text using regular expressions.
- re_match_flag(text
str, origin: str) -> list[str]: Extracts flags matching the given origin from the text.
- re_match_partial_flag(text
str, origin: str) -> list[str]: Extracts partial or complete flags matching the given origin from the text.
Classes¶
ManagerCrypto provides utility methods for common cryptographic operations and flag extraction used in CTF challenges. |
Module Contents¶
- class ManagerCrypto(*args, **kwargs)[source]¶
ManagerCrypto provides utility methods for common cryptographic operations and flag extraction used in CTF challenges. .. method:: initializing_all_ancestors(*args, **kwargs)
Initializes all ancestors of the class. (Currently a placeholder.)
- xor(text
str, key: str) -> str: XORs the input text with the provided key and returns the result as a string.
- decode_base64(text
str) -> str: Decodes a base64-encoded string and returns the decoded text.
- re_match_base64_string(text
str, strict: bool = False) -> list[str]: Finds and returns all base64 strings in the input text. If strict is True, matches only strings with padding.
- re_match_flag(text
str, origin: str) -> list[str]: Searches for flags in the input text matching the pattern ‘{origin}{…}’ and returns all matches.
- re_match_partial_flag(text
str, origin: str) -> list[str]: Searches for partial flags in the input text matching the pattern ‘{origin}{…}’ or ‘{…}’ and returns all matches.
- initializing_all_ancestors(*args, **kwargs)[source]¶
- Description:
Initializes all the ancestors of the class