Invisible Code JS is a security-focused proof of concept that allows JavaScript code to be hidden using zero-width Unicode characters. By encoding code into an invisible format, it becomes undetectable to the naked eye while remaining fully functional when executed.
Caution
Disclaimer: This project is intended for educational and ethical research purposes only. Any misuse for malicious, illegal, or unethical activities is strictly prohibited. Users assume full responsibility for compliance with all applicable laws and regulations. The author is not liable for any misuse.
- The code is designed to accept Unicode characters as input;
- The input is converted into an 8-bit string;
- The 8-bit string is transformed into a binary string;
- The binary string (ones and zeros) is mapped as follows:
- 0 (zero): U+200C ZERO WIDTH NON-JOINER
- 1 (one): U+200D ZERO WIDTH JOINER
- This forms the invisible code.
A few files can be found in the /src folder:
build.js: Encodes the code string to invisible code and returns a script that decodes the invisible code and runs it;decode.js: Decodes the invisible code to a code string;encode.js: Encodes the code string to invisible code.
📥 Input: String containing invisible code.
📤 Output: String containing JavaScript code that decodes and runs the invisible code.
- Copy the code from
build.js; - Assign JavaScript code as a string to the first variable;
- Run the code.
📥 Input: String containing JavaScript code.
📤 Output: String containing invisible code, enclosed in single quotes.
- Copy the code from
encode.js; - Assign JavaScript code as a string value to the first variable;
- Run the code.
Tip
Copy the script's output (invisible code enclosed in single quotes) and use as input for the decode script.
📥 Input: String containing invisible code.
📤 Output: String containing the original encoded JavaScript code.
- Copy the code from
decode.js; - Replace the value of the first variable, with the output from the encode script;
- Run the code.
Tip
Ensure you don't miss any invisible code when copying by copying the full output from the encode script, including the single quotes. Then, replace the single quotes defining the first variable value in the decode script.
Code released under the MIT license.
If you found this code helpful, please consider making a donation or become a sponsor to support my work. Even a small donation can make a big difference! ❤️