2 ms·
Here's the decoder ring: https://github.com/aemkei/jsfuck/blob/master/jsfuck.js https://github.com/aemkei/jsfuck/blob/master/jsfuck.js With this I was able to
by city41 5y ago
Here's the decoder ring: https://github.com/aemkei/jsfuck/blob/master/jsfuck.js https://github.com/aemkei/jsfuck/blob/master/jsfuck.js
With this I was able to get the letter 'a' by starting with their initial definition `(false+"")[1]`, then continually substituting
(false+'')[1]
(![]+'')[1]
(![]+([]+[]))[1]
(![]+([]+[]))[+!(+[])]
All of the above lines when evaluated result in 'a'.
- hn_throwaway_99 5y agoYep, in addition the other part that helped me understand was how it encodes eval for actually executing code. Details are on this line, https://github.com/aemkei/jsfuck/blob/1f02651e98da1c13aef76d609755a2568a1aa6b4/jsfuck.js#L335 https://github.com/aemkei/jsfuck/blob/1f02651e98da1c13aef76d... , and details of that are: 1. [] => An array object 2. []["flat"] => The built in flat function on the Array object 3. []["flat"]["constructor"] => The constructor of any JS function is the Function constructor, which can take JavaScript, as a string, as its sole parameter. Thus, to create a function that executes any CODE_AS_STRING: 4. []["flat"]["constructor"](CODE_AS_STRING) => gives you the Function object, and finally: 5. []["flat"]["constructor"](CODE_AS_STRING)() => executes it Thus, all that's left is to encode the strings "flat", "constructor" and CODE_AS_STRING using the patterns described early in that file.