diff --git a/docs/02_builtin.md b/docs/02_builtin.md
index 8507f5f..be5aa86 100644
--- a/docs/02_builtin.md
+++ b/docs/02_builtin.md
@@ -123,10 +123,14 @@ The following list provides an overview of each build-in plugin, further informa
|--------|------|-------------|---------|
| `1337` | Encoding | Transforms text into "leet speak" by replacing certain letters with numbers or symbols. | N/A |
| `ascii_smuggler` | Encoding | Transforms ASCII text into a series of Unicode rags that are generally invisible to most UI elements (bypassing content filters). | N/A |
+| `atbash` | Encoding | Transforms the input text with the Atbash cipher. Maps each letter to its counterpart on the other end of the alphabet (A <->Z, B<->Y, etc.), preserving case. | `hint` (show the literal plaintext string `atbash` in the encoded output, default true) |
| `base64` | Encoding | Encodes text using Base64 encoding. | N/A |
-| `ceasar` | Encoding | Applies a Caesar cipher to the text, shifting letters by a specified number of positions. | `shift` (number of positions to shift, default: 3) |
+| `binary` | Encoding | Encodes text as space-separated ASCII/Unicode binary codepoint values (8 bits each).| N/A |
+| `caesar` | Encoding | Applies a Caesar cipher to the text, shifting letters by a specified number of positions. | `shift` (number of positions to shift, default: 3) |
+| `decimal` | Encoding | Encodes text as space-separated ASCII/Unicode decimal codepoint values. | `hint` (show the literal plaintext string `decimal` in the encoded output, default true) |
| `hex` | Encoding | Encodes text into its hexadecimal representation. | N/A |
| `morse` | Encoding | Encodes text into Morse code. | N/A |
+| `octal` | Encoding | Encodes text as space-separated ASCII/Unicode octal codepoint values. | `hint` (show the literal plaintext string `octal` in the encoded output, default true) |
| `best_of_n` | Obfuscation, Attack-Based | Implements ["Best-of-N Jailbreaking" John Hughes et al., 2024](https://arxiv.org/html/2412.03556v1#A1) to apply character scrambling, random capitalization, and character noising. | `variants` (number of variations to generate, default: 50) |
| `flip` | Obfuscation | Applies a flip attack to obfuscate text:
- FWO: Flip Word Order
- FCW: Flip Chars in Word
- FCS: Flip Chars in Sentence | `mode` (the flip mode to apply, default: `FWO`) |
| `mask` | Obfuscation, LLM | Masks high-risk words in the text with random character sequences, while providing a suffix that maps the masks back to the original words. | `advanced` (if true, creates multiple masks for longer words)
`advanced-split` (the number of characters per mask chunk for the advanced option, default: 6) |
@@ -186,4 +190,4 @@ spikee test --dataset datasets/dataset-name.jsonl \
--attack-options 'max-turns=5,model=bedrock/deepseek-v3' \
--attack-only
-```
\ No newline at end of file
+```
diff --git a/spikee/plugins/atbash.py b/spikee/plugins/atbash.py
new file mode 100644
index 0000000..4f56718
--- /dev/null
+++ b/spikee/plugins/atbash.py
@@ -0,0 +1,91 @@
+"""
+Atbash Plugin
+
+This basic plugin transforms the input text with the Atbash transformation, which swaps letters
+with their counterpart on the other side of the alphabet. A becomes Z, B becomes Y, etc.,
+until Y becomes B and Z becomes A.
+Case of the original letter is preserved.
+
+
+Usage:
+ spikee generate --plugins atbash
+ spikee generate --plugins atbash --plugin-options "atbash:hint=false"
+
+Reference:
+ https://mindgard.ai/blog/bypassing-azure-ai-content-safety-guardrails
+
+Parameters:
+ text (str): The input text to be transformed.
+ exclude_patterns (List[str], optional): Supplied by the framework. Substrings matching
+ these regex patterns are preserved as-is.
+
+Returns:
+ str: The transformed text.
+"""
+
+from typing import List, Optional
+
+from spikee.templates.basic_plugin import BasicPlugin
+from spikee.utilities.enums import ModuleTag
+from spikee.utilities.hinting import ModuleDescriptionHint, ModuleOptionsHint
+from spikee.utilities.modules import parse_options
+
+
+class AtbashPlugin(BasicPlugin):
+ _ALPHA_UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ _ALPHA_LOWER = "abcdefghijklmnopqrstuvwxyz"
+ ATBASH_TABLE = str.maketrans(
+ _ALPHA_UPPER + _ALPHA_LOWER,
+ _ALPHA_UPPER[::-1] + _ALPHA_LOWER[::-1],
+ )
+
+ def get_description(self) -> ModuleDescriptionHint:
+ return [ModuleTag.ENCODING], "Applies Atbash cipher with optional hint."
+
+ def get_available_option_values(self) -> ModuleOptionsHint:
+ return [
+ "hint=true",
+ "hint=true/false (hint=true prepends the literal string 'atbash ' to the full output)",
+ ], False
+
+ def plugin_transform(self, text: str, plugin_option: str = "") -> str:
+ """
+ Transforms the input text using the Atbash cipher.
+
+ Args:
+ text (str): The input text (or chunk thereof).
+ plugin_option (str, optional): Plugin options string.
+
+ Returns:
+ str: The Atbash-transformed text.
+ """
+ return self._apply_atbash(text)
+
+ def transform(
+ self,
+ text: str,
+ exclude_patterns: Optional[List[str]] = None,
+ plugin_option: str = "",
+ ) -> str:
+ """
+ Overrides BasicPlugin.transform solely to apply the optional hint prefix.
+
+ Args:
+ text (str): The full input text.
+ exclude_patterns (List[str], optional): Passed through to BasicPlugin for exclusion handling.
+ plugin_option (str, optional): Plugin options string.
+
+ Returns:
+ str: The transformed text, with optional 'atbash ' prefix.
+ """
+ opts = parse_options(plugin_option)
+ hint = opts.get("hint", "true").lower() == "true"
+
+ transformed = super().transform(
+ text, exclude_patterns=exclude_patterns, plugin_option=plugin_option
+ )
+
+ return "atbash " + transformed if hint else transformed
+
+ def _apply_atbash(self, text: str) -> str:
+ return text.translate(self.ATBASH_TABLE)
diff --git a/spikee/plugins/binary.py b/spikee/plugins/binary.py
new file mode 100644
index 0000000..3a5157a
--- /dev/null
+++ b/spikee/plugins/binary.py
@@ -0,0 +1,39 @@
+"""
+Binary Plugin
+
+Encodes text as space-separated ASCII/Unicode binary codepoint values (8 bits each).
+"Spikee plugin" > "01010011 01110000 01101001 01101011 01100101 01100101 00100000
+01110000 01101100 01110101 01100111 01101001 01101110"
+
+Usage:
+ spikee generate --plugins binary
+
+Parameters:
+ text (str): Input string to transform.
+ exclude_patterns (List[str], optional): Supplied by the framework. Substrings matching
+ these regex patterns are preserved as-is.
+
+Returns:
+ str: Space-separated 8-bit binary codepoint values.
+"""
+
+from spikee.templates.basic_plugin import BasicPlugin
+from spikee.utilities.enums import ModuleTag
+from spikee.utilities.hinting import ModuleDescriptionHint, ModuleOptionsHint
+
+
+class BinaryPlugin(BasicPlugin):
+ def get_description(self) -> ModuleDescriptionHint:
+ return [
+ ModuleTag.ENCODING
+ ], "Encodes text as 8-bit binary codepoint representation."
+
+ def get_available_option_values(self) -> ModuleOptionsHint:
+ return [], False
+
+ def plugin_transform(self, text: str, plugin_option: str = "") -> str:
+ return self._apply_binary(text)
+
+ def _apply_binary(self, text: str) -> str:
+ """Return space-separated 8-bit binary Unicode codepoints for each character."""
+ return " ".join(f"{ord(c):08b}" for c in text)
diff --git a/spikee/plugins/ceasar.py b/spikee/plugins/caesar.py
similarity index 68%
rename from spikee/plugins/ceasar.py
rename to spikee/plugins/caesar.py
index 5e2b8c8..8404866 100644
--- a/spikee/plugins/ceasar.py
+++ b/spikee/plugins/caesar.py
@@ -1,39 +1,41 @@
"""
Caesar Cipher Plugin
-This plugin transforms the input text using a simple Caesar cipher encryption.
+This plugin transforms the input text using a simple Caesar cipher.
By default, it shifts letters forward by a 3 number of positions in the alphabet.
+"Hello" with shift=3 > "Khoor"
+Use shift=13 for rot13, which is its own reverse.
Usage:
spikee generate --plugins caesar
+ spikee generate --plugins caesar --plugin-options "caesar:shift=5"
Parameters:
text (str): The input text to be transformed.
shift (int): The number of positions to shift each letter (default is 3).
-
Returns:
str: The encrypted text using the Caesar cipher.
"""
from typing import List, Optional
-from spikee.templates.plugin import Plugin
-from spikee.utilities.hinting import ModuleDescriptionHint, ModuleOptionsHint
+from spikee.templates.basic_plugin import BasicPlugin
from spikee.utilities.enums import ModuleTag
+from spikee.utilities.hinting import ModuleDescriptionHint, ModuleOptionsHint
-class CeasarPlugin(Plugin):
+class CaesarPlugin(BasicPlugin):
DEFAULT_SHIFT = 3
def get_description(self) -> ModuleDescriptionHint:
return [ModuleTag.ENCODING], "Transforms text using a Caesar cipher encryption."
def get_available_option_values(self) -> ModuleOptionsHint:
- """Return supported attack options; Tuple[options (default is first), llm_required]"""
- return [
- "shift=3",
- "shift=N (1-26)",
- ], False
+ return ["shift=3", "shift=N (1-26)", "shift=13 for rot13"], False
+
+ def plugin_transform(self, content: str, plugin_option: str = "") -> str:
+ shift = self._parse_shift_option(plugin_option)
+ return self.caesar_cipher(content, shift)
def _parse_shift_option(self, option: str) -> int:
"""Parse shift option string like 'shift=3' and return the number."""
@@ -46,42 +48,22 @@ def _parse_shift_option(self, option: str) -> int:
pass
return self.DEFAULT_SHIFT
- def caesar_cipher(self, text: str, shift: int = 3) -> str:
+ def caesar_cipher(self, content: str, shift: int = 3) -> str:
"""
Encrypts the input text using a Caesar cipher with the given shift value.
Args:
- text (str): The input text.
+ content (str): The input text.
shift (int): The number of positions to shift each letter.
Returns:
str: The encrypted text.
"""
result = []
- for char in text:
+ for char in content:
if char.isalpha():
shift_base = ord("A") if char.isupper() else ord("a")
result.append(chr((ord(char) - shift_base + shift) % 26 + shift_base))
else:
result.append(char)
return "".join(result)
-
- def transform(
- self,
- content: str,
- exclude_patterns: Optional[List[str]] = None,
- plugin_option: str = ""
- ) -> str:
- """
- Transforms the input text using the Caesar cipher.
-
- Args:
- text (str): The input text.
- shift (int): The number of positions to shift each letter (default is 3).
-
- Returns:
- str: The encrypted text using the Caesar cipher.
- """
- shift = self._parse_shift_option(plugin_option)
-
- return self.caesar_cipher(content, shift)
diff --git a/spikee/plugins/decimal.py b/spikee/plugins/decimal.py
new file mode 100644
index 0000000..b84561b
--- /dev/null
+++ b/spikee/plugins/decimal.py
@@ -0,0 +1,69 @@
+"""
+DecimalEncoder Plugin
+
+Encodes text as space-separated ASCII/Unicode decimal codepoint values.
+"Spikee plugin" > "decimal 83 112 105 107 101 101 32 112 108 117 103 105 110"
+
+Usage:
+ spikee generate --plugins decimal
+ spikee generate --plugins decimal --plugin-options "decimal:hint=false"
+
+Parameters:
+ text (str): Input string to transform.
+ exclude_patterns (List[str], optional): Supplied by the framework. Substrings matching
+ these regex patterns are preserved as-is.
+
+Returns:
+ str: Space-separated decimal codepoint values, prefixed with 'decimal ' by default.
+"""
+
+from typing import List, Optional
+
+from spikee.templates.basic_plugin import BasicPlugin
+from spikee.utilities.enums import ModuleTag
+from spikee.utilities.hinting import ModuleDescriptionHint, ModuleOptionsHint
+from spikee.utilities.modules import parse_options
+
+
+class DecimalEncoderPlugin(BasicPlugin):
+ def get_description(self) -> ModuleDescriptionHint:
+ return [ModuleTag.ENCODING], "Encodes text as decimal codepoint representation."
+
+ def get_available_option_values(self) -> ModuleOptionsHint:
+ return [
+ "hint=true",
+ "hint=true/false (hint=true prepends the literal string 'decimal ' to the full output)",
+ ], False
+
+ def plugin_transform(self, content: str, plugin_option: str = "") -> str:
+ return self._apply_decimal(content)
+
+ def transform(
+ self,
+ content: str,
+ exclude_patterns: Optional[List[str]] = None,
+ plugin_option: str = "",
+ ) -> str:
+ """
+ Overrides BasicPlugin.transform solely to apply the optional hint prefix.
+
+ Args:
+ content (str): The full input text.
+ exclude_patterns (List[str], optional): Passed through to BasicPlugin for exclusion handling.
+ plugin_option (str, optional): Plugin options string.
+
+ Returns:
+ str: The transformed text, with optional 'decimal ' prefix.
+ """
+ opts = parse_options(plugin_option)
+ hint = opts.get("hint", "true").lower() == "true"
+
+ transformed = super().transform(
+ content, exclude_patterns=exclude_patterns, plugin_option=plugin_option
+ )
+
+ return "decimal " + transformed if hint else transformed
+
+ def _apply_decimal(self, content: str) -> str:
+ """Return space-separated decimal Unicode codepoints for each character."""
+ return " ".join(str(ord(c)) for c in content)
diff --git a/spikee/plugins/octal.py b/spikee/plugins/octal.py
new file mode 100644
index 0000000..72b5108
--- /dev/null
+++ b/spikee/plugins/octal.py
@@ -0,0 +1,69 @@
+"""
+OctalEncoder Plugin
+
+Encodes text as space-separated ASCII/Unicode octal codepoint values.
+"Spikee plugin" > "octal 123 160 151 153 145 145 40 160 154 165 147 151 156"
+
+Usage:
+ spikee generate --plugins octal
+ spikee generate --plugins octal --plugin-options "octal:hint=false"
+
+Parameters:
+ text (str): Input string to transform.
+ exclude_patterns (List[str], optional): Supplied by the framework. Substrings matching
+ these regex patterns are preserved as-is.
+
+Returns:
+ str: Space-separated octal codepoint values, prefixed with 'octal ' by default.
+"""
+
+from typing import List, Optional
+
+from spikee.templates.basic_plugin import BasicPlugin
+from spikee.utilities.enums import ModuleTag
+from spikee.utilities.hinting import ModuleDescriptionHint, ModuleOptionsHint
+from spikee.utilities.modules import parse_options
+
+
+class OctalEncoderPlugin(BasicPlugin):
+ def get_description(self) -> ModuleDescriptionHint:
+ return [ModuleTag.ENCODING], "Encodes text as octal codepoint representation."
+
+ def get_available_option_values(self) -> ModuleOptionsHint:
+ return [
+ "hint=true",
+ "hint=true/false (hint=true prepends the literal string 'octal ' to the full output)",
+ ], False
+
+ def plugin_transform(self, content: str, plugin_option: str = "") -> str:
+ return self._apply_octal(content)
+
+ def transform(
+ self,
+ content: str,
+ exclude_patterns: Optional[List[str]] = None,
+ plugin_option: str = "",
+ ) -> str:
+ """
+ Overrides BasicPlugin.transform solely to apply the optional hint prefix.
+
+ Args:
+ content (str): The full input text.
+ exclude_patterns (List[str], optional): Passed through to BasicPlugin for exclusion handling.
+ plugin_option (str, optional): Plugin options string.
+
+ Returns:
+ str: The transformed text, with optional 'octal ' prefix.
+ """
+ opts = parse_options(plugin_option)
+ hint = opts.get("hint", "true").lower() == "true"
+
+ transformed = super().transform(
+ content, exclude_patterns=exclude_patterns, plugin_option=plugin_option
+ )
+
+ return "octal " + transformed if hint else transformed
+
+ def _apply_octal(self, content: str) -> str:
+ """Return space-separated octal Unicode codepoints for each character."""
+ return " ".join(f"{ord(c):o}" for c in content)