Last active
May 9, 2022 11:42
-
-
Save stonegray/99571839126dc43889a9f88dfb1eb556 to your computer and use it in GitHub Desktop.
Evil Eval()
This file contains 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
<!-- ~~~~~~~~~~~~~~~~~~~~ --> | |
/$$ Stones Evil Eval() $$/ | |
<!-- ~~~~~~~~~~~~~~~~~~~~ --> | |
/* | |
* This file implements an alternate version of the builtin eval(); | |
* function. Please note this is known to crash some parsers. (fixed | |
* in latest versions) | |
* | |
* If this loads missing indentation on GitHub, just reload the page. | |
* | |
* Recommended for use with Node 16.5+ and a strong coffee. | |
*/ | |
async function eval2 (string, el = [], eval = new Proxy({}, { | |
el: new Array({q: process?.exit}), | |
get: (el, index)=> { | |
async function* _2 (){ | |
typedef: while (el ?? ++(1).__proto__) yield arguments ?null?? | |
2**4:1, | |
0x3 + arguments[el]; | |
}; | |
return arguments, _2; | |
}, | |
set: importantVariable=>{ | |
el.con = [ "constructor", Proxy, el.push];; | |
[].forEach.call(arguments, ()=> el.pop()); debugger; $: | |
el.push.__proto__; | |
el.push((__proto__) => Object[el.con[+(1).__proto__]](__proto__)()); | |
private: { | |
el.push(_=>[]["filter"][el.con[+!typeof private]](_)()); | |
if (el.map && 0b1<2<< +Object) break private; | |
el.push(_=>new Proxy({...el}, this)) | |
} | |
el?.push(_=>{throw Error[arguments[0]]}, _=>Date.constructor.call({}, _)()); | |
el.push(([ | |
"a", | |
arguments.__defineGetter__, | |
this.el], | |
el.pop())); | |
el[Math.floor(Math.random()*el.length)](arguments[0]); | |
}})) | |
{ | |
for await (const f of eval.toString()){ | |
try { | |
return eval.valueOf = /wtf/, string; | |
} catch (e) { | |
continue; | |
} | |
} | |
} | |
eval2(` | |
const a = 123; | |
console.log("Testing testing", a) | |
`); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment