diff --git a/files/nosemi/main.js b/files/nosemi/main.js index 1ba556c..7c7a569 100644 --- a/files/nosemi/main.js +++ b/files/nosemi/main.js @@ -53,8 +53,7 @@ let func2let=((a)=>{ a=a.replace("function ",""); let funcname=a.slice(0,a.indexOf("(")); let funcprop=a.slice(a.indexOf("("))+"=>"; - console.log(funcprop) - return `let ${funcname}=${funcprop}`; + return `globalThis.${funcname}=${funcprop}`; }) for(let i=0;i{ }; return a; }); -let unsemicolon=((a)=>{ +let unsemicolon=((a,b)=>{ if(a.length==1&&typeof(a[0])!="object"){ - return a[0].replaceAll(";","") + a=a[0].replaceAll(";","") + return (b?`()=>{${a}}`:a); } let out=[]; for(let i=0;i{ }; out.push("()=>{"+removeSpacing(b)+"}") }; - out=out.join(",");out=`[${out}].forEach(a=>a())`; + out=out.join(","); + if(!b){out=`[${out}].forEach(a=>a())`;} return out; }); +let returnFunction=((a)=>{ + let varname=(()=>{ + let varchs="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"; + return "__"+[...Array(8).keys()].map(()=>varchs[Math.floor(Math.random()*varchs.length)]).join("") + }) + let rf=((a)=>{ + if(!a.join(";").includes("return")){return a}; + let vars=["a","b","c","d","e"]; + vars=vars.map(varname); + let funcInstructions=`[${unsemicolon(windowify(func2let(a)),true)}]`; + let stack=[ + `globalThis.${vars[1]}=null`, + `globalThis.${vars[2]}=true`, + `globalThis.${vars[3]}=null`, + `globalThis.${vars[4]}=(${vars[0]})=>{${unsemicolon(windowify(parseInstructions(`if(${vars[2]}){${vars[1]}=${vars[0]}();if(${vars[1]}){${vars[3]}=${vars[1]};${vars[2]}=!${vars[2]};};};`)))}}`, + `${funcInstructions}.forEach(${vars[4]});` + ]; + return ["return "+unsemicolon(stack)+','+vars[3]]; + }); + for(let i=0;i