-- FlowAuth isolated console return (function(...) local kind,protect,raise=type,pcall,error local getEnvironment,setEnvironment,compile=getfenv,setfenv,loadstring if kind(getEnvironment)~="function" or kind(setEnvironment)~="function" then return nil,"Silent execution is unavailable in this executor" end local base=getEnvironment() local inherited=rawget(base,"__flowauth_console_scope") local shared=base if kind(getgenv)=="function" then local ok,value=protect(getgenv);if ok and kind(value)=="table" then shared=value end end if kind(inherited)=="table" and kind(inherited.base)=="table" and kind(inherited.compile)=="function" then base,shared,compile=inherited.base,inherited.shared,inherited.compile end local unpackValues=table.unpack or unpack local function pack(...)return {n=select("#",...),...}end local quiet=true local pending={} local authoredError local nativeProtectedRuntime=false local nativePrint,nativeWarn=base.print,base.warn local nativeRawGet,nativeRawSet=rawget,rawset local function output(fn,...) if quiet==nil then if #pending<32 then pending[#pending+1]={fn,pack(...)}end elseif not quiet and kind(fn)=="function" then fn(...)end end local function decide(value) if quiet~=nil then return end quiet=value if not quiet then for _,entry in ipairs(pending)do if kind(entry[1])=="function" then entry[1](unpackValues(entry[2],1,entry[2].n))end end end pending={} end local scope,sharedScope={},{} setmetatable(scope,{__index=base,__newindex=base}) setmetatable(sharedScope,{__index=shared,__newindex=shared}) local function mutedPrint(...)output(nativePrint,...)end local function mutedWarn(...)output(nativeWarn,...)end local function scopedCompile(text,name) -- Luraph STATIC_ENVIRONMENT forbids changing the compiled function's -- environment. Keep its native globals and compiler, including the -- customer chunks it compiles. Output isolation applies only to the -- plaintext launcher/init/UI paths that support environment rebinding. if name=="=FlowAuthRuntime" then nativeProtectedRuntime=true return compile(text,name) end if kind(text)=="string" then local prefix=string.sub(text,1,256) if string.find(prefix,"-- FlowAuth console: silent",1,true)then decide(true) elseif string.find(prefix,"-- FlowAuth console: normal",1,true)then decide(false)end end local chunk,reason=compile(text,name) if kind(chunk)=="function" then if name=="=FlowAuth" or name=="=FlowAuthInit" or name=="=FlowAuthUI" then setEnvironment(chunk,base) local function authored(fn) return function(...) local values=pack(protect(fn,...)) if not values[1] then authoredError=values[2];raise(values[2],0)end if name=="=FlowAuthInit" and kind(values[2])=="function" then values[2]=authored(values[2])end return unpackValues(values,2,values.n) end end return authored(chunk) end setEnvironment(chunk,scope) end return chunk,reason end local function scopedRawGet(environment,key) if environment==scope or environment==sharedScope then local own=nativeRawGet(environment,key) if own~=nil then return own end return nativeRawGet(environment==scope and base or shared,key) end return nativeRawGet(environment,key) end local function scopedRawSet(environment,key,value) if environment==scope then nativeRawSet(base,key,value);return environment end if environment==sharedScope then nativeRawSet(shared,key,value);return environment end return nativeRawSet(environment,key,value) end for _,environment in ipairs({scope,sharedScope})do rawset(environment,"__flowauth_console_scope",{base=base,shared=shared,compile=compile}) rawset(environment,"rawget",scopedRawGet);rawset(environment,"rawset",scopedRawSet) rawset(environment,"print",mutedPrint);rawset(environment,"warn",mutedWarn) rawset(environment,"loadstring",scopedCompile) rawset(environment,"getgenv",function()return sharedScope end) rawset(environment,"_G",sharedScope) end local function run(...) local credential=... local type,pcall,error,tostring,tonumber=type,pcall,error,tostring,tonumber local rawset,getfenv=rawset,getfenv local globals,host=_G,game local byte,gsub,find=string.byte,string.gsub,string.find local wait=type(task)=="table"and task.wait local clock=os.clock local compile=loadstring local function member(value,key) local ok,result=pcall(function()return value[key]end) if ok then return result end end local keyless=true if keyless then credential="" elseif type(credential)~="string"then for lv=2,4 do local f,sc=pcall(getfenv,lv) local v=f and type(sc)=="table"and member(sc,"script_key") if type(v)=="string"then credential=v;pcall(rawset,sc,"script_key",nil);break end end end local spawn=member(task,"spawn") local fetch=member(host,"HttpGet") local ok,senv=pcall(function()return getfenv()end) if not ok or type(senv)~="table"then senv=globals end local ok,environment=pcall(function()return getgenv()end) if not ok or type(environment)~="table"then environment=senv end local function global(key)return member(environment,key)or member(senv,key)or member(globals,key)end local sample=20 local platform="?" pcall(function() local input=host:GetService("UserInputService") platform=input.TouchEnabled and not input.KeyboardEnabled and"m"or"d" end) local function ms(x)return math.floor(x*1000+.5)end local reqs,seen={},{} local function add(fn,name) if type(fn)=="function"and not seen[fn]then seen[fn]=true;reqs[#reqs+1]={fn,name}end end add(global("request"),"request") add(global("http_request"),"http_request") add(global("httpRequest"),"httpRequest") add(global("httprequest"),"httprequest") add(member(global("http"),"request"),"http.request") add(member(global("syn"),"request"),"syn.request") local bt=member(global("buffer"),"tostring") local url="\104\116\116\112\115\58\47\47\102\108\111\119\97\117\116\104\46\110\101\116\47\97\115\115\101\116\115\47\102\108\111\119\97\117\116\104\47\115\104\97\50\53\54\47\100\99\54\53\97\102\55\56\54\57\56\50\56\55\98\99\50\49\53\49\98\97\102\100\98\100\54\55\49\53\52\48\54\100\53\51\53\102\102\53\100\52\98\102\51\54\53\55\50\50\100\56\102\54\54\102\102\48\97\102\51\101\55\98\47\118\52\95\98\111\111\116\115\116\114\97\112\112\101\114\95\109\97\114\98\101\103\46\108\117\97" local fallback="\104\116\116\112\115\58\47\47\51\55\46\49\56\55\46\49\51\54\46\49\56\55\47\97\115\115\101\116\115\47\102\108\111\119\97\117\116\104\47\115\104\97\50\53\54\47\100\99\54\53\97\102\55\56\54\57\56\50\56\55\98\99\50\49\53\49\98\97\102\100\98\100\54\55\49\53\52\48\54\100\53\51\53\102\102\53\100\52\98\102\51\54\53\55\50\50\100\56\102\54\54\102\102\48\97\102\51\101\55\98\47\118\52\95\98\111\111\116\115\116\114\97\112\112\101\114\95\109\97\114\98\101\103\46\108\117\97" local fresh=url.."?retry=a03a2b8996ea0e29" local retry=gsub(url,"/sha256/[a-f0-9]+/","/").."?retry=a03a2b8996ea0e29" local expected=632423 local runtime,reason,issue,pr=nil,nil,"timed out",0 local transport,issueTransport="HttpGet","HttpGet" local function problem(message,rank) if rank>=pr then issue,pr,issueTransport=message,rank,transport end end local arrived,ck,cm=0,0,0 local function accept(value) local began=clock() if type(value)=="buffer"then local ok,text=pcall(bt,value);value=ok and text or nil end if type(value)~="string"then problem("unsupported response body",1);return end if #value~=expected then if #value<1024 and find(value,"Failed to send HTTP request.",1,true)then problem(find(value,"timed out",1,true)and"HTTP request timed out"or"HTTP request failed",2) else problem("received "..#value.." bytes; expected "..expected,2)end return end local s1,s2,i=1.0,0.0,1 while i+7<=#value do local a,b,c,d,e,f,g,h=byte(value,i,i+7) s2=(s2+8*s1+8*a+7*b+6*c+5*d+4*e+3*f+2*g+h)%65521 s1=(s1+a+b+c+d+e+f+g+h)%65521;i=i+8 end while i<=#value do s1=(s1+byte(value,i))%65521;s2=(s2+s1)%65521;i=i+1 end if s2*65536.0+s1~=3646516830 then problem("runtime checksum mismatch",3);return end local t=clock();ck=t-began local ok,compiled,detail=pcall(compile,value,"=FlowAuthRuntime") local text=not(ok and type(compiled)=="function")and tostring(ok and detail or compiled) if text and not(find(text,"FlowAuthRuntime:")or find(text,"xpected")or find(text,"syntax"))then if wait then pcall(wait,1.5)end ok,compiled,detail=pcall(compile,value,"=FlowAuthRuntime") end cm=clock()-t if ok and type(compiled)=="function"then runtime=compiled;return true end reason=(ok and detail or compiled)or"compiler returned no function";issueTransport=transport return false end local cs={{fetch,"HttpGet",url}} if fallback~=""then cs[#cs+1]={fetch,"HttpGet",fallback,true}end for i=1,#reqs do local candidate=reqs[i] if fallback~=""then cs[#cs+1]={candidate[1],candidate[2],fallback,true}end cs[#cs+1]={candidate[1],candidate[2],fresh} end cs[#cs+1]={fetch,"HttpGet",retry} local started,ni,ls,idle=clock(),1,0,0 local js,shut,alternate={},false,false local asynchronous=type(spawn)=="function"and type(wait)=="function" local function launch() local candidate=cs[ni];ni=ni+1;ls=clock() local job={name=candidate[2],alternate=candidate[4]};js[#js+1]=job local function run() if shut or job.started then return end job.started=true local ok,response if job.name=="HttpGet"then ok,response=pcall(candidate[1],host,candidate[3]) else ok,response=pcall(candidate[1],{Url=candidate[3],Method="GET"})end if not shut then job.ok,job.response,job.done=ok,response,true end end if asynchronous then local ok,thread=pcall(spawn,run);job.thread=ok and thread or nil if not job.started and type(job.thread)~="thread"then asynchronous=false;run()end else run()end end launch() for poll=1,4000 do local active,completed=0,false for i=1,#js do local job=js[i] if not job.done then active=active+1 elseif not job.read then job.read=true;completed=true;transport=job.name;arrived=clock()-started local response=job.response;job.response=nil if not job.ok then problem("request failed",1) elseif type(response)=="table"then local status=tonumber(member(response,"StatusCode")or member(response,"status_code")or member(response,"Status")or member(response,"status"))or 0 local success=member(response,"Success");if success==nil then success=member(response,"success")end if status==0 and success==true then status=200 end if success==false and status<400 then status=500 end if status>=200 and status<300 then accept(member(response,"Body")or member(response,"body")or member(response,"ResponseBody")or member(response,"response_body")) else problem("HTTP "..status,2)end else accept(response)end if runtime or reason then alternate=job.alternate;break end end end if runtime or reason or(active==0 and ni>#cs)then break end local t=clock() if t-started-idle>=40 then problem("HTTP download timed out after 40 seconds",4);break end if ni<=#cs and(active==0 or(active<2 and(completed or t-ls>=8)))then launch() elseif not pcall(wait,.03)then problem("HTTP download wait unavailable",4);break else idle=idle+math.max(clock()-t-1,0)end end shut=true for i=1,#js do js[i].response=nil end local function send(base,path,body,delay) local query="?p="..gsub('{"protocol":3,"loader_hash":"\102\99\51\55\57\97\48\50\54\57\56\50\97\97\55\99\100\56\98\97\52\49\101\51\53\52\49\50\54\99\56\54","\108\97\117\110\99\104\95\116\105\99\107\101\116":"\118\50\58\56\112\115\121\77\65\110\48\112\122\118\65\75\117\50\53\58\48\107\51\72\89\82\114\86\116\56\74\102\116\55\113\102\70\67\85\82\112\81\58\72\79\71\88\77\105\72\122\82\45\52\75\114\101\98\98\87\112\66\120\114\118\87\53\72\120\97\79\53\66\104\100\57\84\80\52\54\73\74\56\78\114\112\78\84\113\56\67\54\113\100\106\109\119\72\101\56\69\98\71\116\85\122\72\116\117\52\118\82\103\99\88\116\103\113\49\119\73\54\105\75\53\118\70\65\85\56\122\54\83\75\53\76\79\66\98\102\78\118\117\99\45\99\87\113\76\57\73\51\75\87\66\66\54\107\52\122\82\107\108\75\54\103\82\99\50\121\81\95\79\113\111\97\76\57\105\80\101\83\79\57\79\106\79\48\98\101\57\82\48\75\117\72\74\75\74\79\106\51\102\97\86\75\74\119\121\73\56\106\70\113\68\45\83\81\54\83\103\110\108\76\45\102\72\54\105\75\109\98\57\56\114\115\89\97\110\107\71\67\102","stage":"'..body,"[^%w]",function(c)return string.format("%%%02X",byte(c))end) pcall(spawn,function() if delay then pcall(wait,delay)end local target=gsub(base,"/assets/.*",path)..query if not pcall(fetch,host,target)and reqs[1]then pcall(reqs[1][1],{Url=target,Method="GET"})end end) end if not runtime then pcall(function() local text=gsub(issueTransport..": "..tostring(reason or issue),"[^%w .:;,()=/_-]","?") local body=(reason and"launcher_load"or"launcher_download")..'","executor":"launcher","diag":["pf='..platform..'"],"error":"'..string.sub(text,1,160)..'"}' for _,base in ipairs{url,fallback}do if base~=""then send(base,"/v1/telemetry/executor",body)end end end) if reason then error("FlowAuth runtime compilation failed: "..tostring(reason),0)end error("FlowAuth runtime download failed ("..issueTransport.."): "..tostring(issue)..". Please run the loader again.",0) end if sample>0 and spawn and math.random(sample)==1 then pcall(send,alternate and fallback or url,"/v1/telemetry/load",'load","pf":"'..platform..'","tp":"'..transport..'","fb":'..(alternate and 1 or 0)..',"tr":'..#js..',"dl":'..ms(arrived)..',"ck":'..ms(ck)..',"cm":'..ms(cm)..',"w":'..sample..'}',2) end if asynchronous then pcall(wait)end local handoff=alternate and {"\92\25\79\58\57\227\14\240\203\201\198\179\204\62\47\79\85\50\150\145\236\221\51\167\51\89\96\214\152\252\58\245\145\13\2\58\218\255\252\64\234\26\49\89\225\249\48\114\155\64\110\64\201\147\194\208\226\106\88\202\26\28\95\117\41\20\18\45\15\166\207\107\124\204\249\194\175\129\72\31\248\244\4\55\120\244\205\139\180\37\10\107\59\243\126\0\79\50\122\244\3\183\169\255\9\77\2\150\214\86\159\118\18\188\215\240\143\121\3\83\154\5\124\1\68\126\151\109\69\47\50\127\167\99\15\19\70\147\179\3\226\117\28\200\120\0\251\127\89\34\196\156\250\51\217\159\37\205\152\219\232\15\45\123\10\48\77\121\180\195\15\152\84\131\37\178\194\78\56\238\121\108\186\3\244\65\190\148\92\0\242\204\30\2\209\225\62\192\75\110\79\17\41\116\36\133\211\129\237\207\73\222\11\177\232\239\183\66\149\207\253\250\105\179\162\197\164\89\78\243\4\35\80\171\223\90\178\200\69\199\52\199\176\223\140\73\123\128\75\185\7\135\205\155\110\199\147\100\173\40\19\132\37\103\44\218\236\216\39\199\192\11\37\49\111\249\134\208\104\132\79\229\160\166\178\210\43\118\35\66\60\25\126\95\12\9\182\2\126\74\86\81\175\55\130\9\212",1941467463,481124608} or {"\139\151\224\237\79\202\32\170\131\114\74\81\92\202\68\78\65\37\83\81\254\65\136\121\200\164\70\79\127\116\132\75\37\112\47\4\44\200\170\131\150\46\153\190\214\236\201\87\37\101\49\162\214\206\58\59\93\63\161\74\242\106\245\78\229\139\197\221\95\64\142\253\25\215\110\43\96\210\183\21\92\178\147\110\150\93\143\172\112\93\24\84\231\140\154\214\189\220\251\218\108\45\254\85\61\62\26\212\92\2\4\23\25\137\195\91\200\235\10\248\69\227\210\148\20\124\136\86\115\107\105\119\18\156\240\61\130\171\213\86\167\72\60\100\175\171\13\0\92\188\33\145\166\62\71\254\110\4\63\98\72\211\181\9\22\238\72\59\14\114\107\217\19\198\179\109\78\68\93\199\97\117\14\138\119\72\195\115\179\16\88\116\120\3\49\254\134\25\57\223\111\172\13\233\252\226\29\126\64\2\226\46\16\80\213\9\145\27\10\83\226\25\185\74\15\183\79\101\179\161\58\215\55\241\193\189\25\171\11\25\215\83\56\173\158\138\33\2\125\64\224\5\6\6\22\140\21\165\190\153\187\239\158\171\187\71\48\77\8\234\128\192\227\167\43\57\82\10\151\128\58\19\5\38\156\113\7\157\83\167\60\117\60\88\128\147\41\161\180\153\42\204\174\70\121",546700819,186409743} local function publish(target) if type(target)=="table"then pcall(rawset,target,"_bsdata0",handoff)end end publish(environment) publish(globals) _bsdata0=handoff pcall(function()publish(getfenv(runtime))end) handoff=nil return runtime(credential) end setEnvironment(run,scope) local result=pack(protect(run,...)) if not result[1] then if nativeProtectedRuntime or quiet==false or (authoredError~=nil and authoredError==result[2]) then raise(result[2],0)end return nil,result[2] end return unpackValues(result,2,result.n) end)(...)