feat: add zero-width character plugin#117
Open
Lalatenduswain wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a zero-width obfuscation plugin that interleaves invisible zero-width Unicode characters between the visible characters of the text.
To a human reader (and in most UIs) the text looks unchanged, but the underlying byte sequence no longer contains any contiguous ASCII substring — defeating naive keyword/regex filters, substring denylists, and byte-level matching. It is the interspersing counterpart to the recently-added
homoglyphplugin:ascii_smugglerreplaces text with invisible Unicode tag characters (visible content disappears).homoglyphsubstitutes Latin glyphs with look-alike confusables (every visible code point changes).zero_widthkeeps the original visible glyphs intact and injects invisible separators between them.Options
char— which zero-width character to insert:zwsp(U+200B, default),zwnj(U+200C),zwj(U+200D),wj(U+2060),zwnbsp/bom(U+FEFF).ratio— fraction of inter-character gaps to fill, 0.0–1.0 (default 1.0, deterministic).seed— optional integer seed for reproducible partial output whenratio< 1.0.Changes
spikee/plugins/zero_width.py— new plugin (subclassesBasicPlugin, soexclude_patternshandling is inherited; taggedEncoding, Obfuscation). Style mirrorshomoglyph.py.tests/functional/test_spikee_list.py— assertzero_widthis discoverable viaspikee list plugins.docs/02_builtin.md— addzero_widthto the built-in plugins reference table.Usage
Testing
char/ratio/seedbehave, andexclude_patternstokens are preserved verbatim.spikee list pluginsshowszero_widthunder Encoding, Obfuscation.developbase (116 passed:test_spikee_list,test_module_loading, fulltest_spikee_generate).