pyrit.prompt_converter.SneakyBitsSmugglerConverter#
- class SneakyBitsSmugglerConverter(action: Literal['encode', 'decode'] = 'encode', zero_char: str | None = None, one_char: str | None = None)[source]#
Bases:
SmugglerConverter
Encodes and decodes text using a bit-level approach.
- Uses two invisible Unicode characters:
zero_char
(default: U+2062) to represent binary 0.one_char
(default: U+2064) to represent binary 1.
- Replicates functionality detailed in:
- __init__(action: Literal['encode', 'decode'] = 'encode', zero_char: str | None = None, one_char: str | None = None)[source]#
Initializes the converter with options for encoding/decoding in Sneaky Bits mode.
- Parameters:
- Raises:
ValueError – If an unsupported action or
encoding_mode
is provided.
Methods
__init__
([action, zero_char, one_char])Initializes the converter with options for encoding/decoding in Sneaky Bits mode.
convert_async
(*, prompt[, input_type])Converts the given prompt by either encoding or decoding it based on the specified action.
convert_tokens_async
(*, prompt[, ...])Converts substrings within a prompt that are enclosed by specified start and end tokens.
decode_message
(message)Decodes the message encoded using Sneaky Bits mode.
encode_message
(message)Encodes the message using Sneaky Bits mode.
get_identifier
()Returns an identifier dictionary for the converter.
input_supported
(input_type)Checks if the input type is supported by the converter.
output_supported
(output_type)Checks if the output type is supported by the converter.
Attributes
supported_input_types
Returns a list of supported input types for the converter.
supported_output_types
Returns a list of supported output types for the converter.
- decode_message(message: str) str [source]#
Decodes the message encoded using Sneaky Bits mode.
The method filters out only the valid invisible characters (
self.zero_char
andself.one_char
), groups them into 8-bit chunks, reconstructs each byte, and finally decodes the byte sequence using UTF-8.