Last active
September 10, 2025 21:56
-
-
Save mendes5/557d100d172825444b29d28cf5a8539c to your computer and use it in GitHub Desktop.
Zero width space decoder. beware!
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
| |
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
| const chunk = (arr, len) => { | |
| var chunks = [],i = 0,n = arr.length; | |
| while (i < n) { | |
| chunks.push(arr.slice(i, i += len)); | |
| } | |
| return chunks; | |
| } | |
| const encode = x => [...x].map(x => x.charCodeAt(0)).map((x,i) => { if (x >= 255) { throw new Error('Found non ascii character at position: ' + i) } return [...x.toString(2).padStart(8, 0)].map(x => x === '0' ? String.fromCharCode(8203) : String.fromCharCode(8204) ).join('') }).join(''); | |
| const decode = x => chunk(x.split(''), 8).map(x => parseInt(x.map(x => x === String.fromCharCode(8203) ? 0 : 1 ).join(''), 2) ).map(x => String.fromCharCode(x)).join(''); |
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
| var data = encode('console.log(localStorage)') | |
| console.log(data) | |
| eval(decode(data)) |
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
| var data = ''; | |
| eval(decode(data)); |
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
| 0.0.constructor.constructor(decode(data))() | |
| // Soooo you need to be able to control two property access, and the argument passed to a function, with user input. | |
| // Or you hide and obfuscate that on a large codebase with tons of layers of indirection, and done! | |
| // But you also need the encoder/decoder implementation, so its kinda pointless |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment