-- Secro macro runtime local __SECRO_NATIVE = function(source, captures) local env = {} local mt = {} mt.__index = function(_, key) local c = captures[key] if c then return c[1]() end return _G[key] end mt.__newindex = function(_, key, value) local c = captures[key] if c and c[2] then return c[2](value) end rawset(env, key, value) end setmetatable(env, mt) local chunk, err = loadstring("return " .. source, "=secro_native") if not chunk then error(err) end local fn = chunk() if setfenv then setfenv(fn, env) end return fn end local function __SECRO_ID(value) return value end local function __SECRO_ATTR() end SECRO_OBFUSCATED = true LPH_OBFUSCATED = true SECRO_NO_VIRTUALIZE = __SECRO_ID LPH_NO_VIRTUALIZE = __SECRO_ID SECRO_VIRTUALIZE = __SECRO_ID LPH_VIRTUALIZE = __SECRO_ID SECRO_ENCSTR = __SECRO_ID LPH_ENCSTR = __SECRO_ID SECRO_ENCNUM = __SECRO_ID LPH_ENCNUM = __SECRO_ID SECRO_STRENC = __SECRO_ID LPH_STRENC = __SECRO_ID SECRO_NUMENC = __SECRO_ID LPH_NUMENC = __SECRO_ID SECRO_ENCBUF = function(value) if buffer and buffer.fromstring then return buffer.fromstring(value) end return value end LPH_ENCBUF = SECRO_ENCBUF SECRO_BUFENC = SECRO_ENCBUF LPH_BUFENC = SECRO_ENCBUF SECRO_CRASH = function() end LPH_CRASH = SECRO_CRASH SECRO_PRECHECK = function(check) if check then check() end end LPH_PRECHECK = SECRO_PRECHECK SECRO_REWRITE = __SECRO_ID LPH_REWRITE = __SECRO_ID SECRO_ASSUME = __SECRO_ID LPH_ASSUME = __SECRO_ID SECRO_OPAQUE = __SECRO_ID LPH_OPAQUE = __SECRO_ID SECRO_ATTRIBUTES = __SECRO_ATTR LPH_ATTRIBUTES = __SECRO_ATTR SECRO_VM = __SECRO_ATTR LPH_VM = __SECRO_ATTR SECRO_PRESET = __SECRO_ATTR LPH_PRESET = __SECRO_ATTR SECRO_OPTIMIZE = __SECRO_ATTR LPH_OPTIMIZE = __SECRO_ATTR SECRO_NO_UPVALUES = __SECRO_ATTR LPH_NO_UPVALUES = __SECRO_ATTR SECRO_ERROR_HANDLING = __SECRO_ATTR LPH_ERROR_HANDLING = __SECRO_ATTR SECRO_UNSAFE_ENVIRONMENT = __SECRO_ATTR LPH_UNSAFE_ENVIRONMENT = __SECRO_ATTR SECRO_UNROLL = __SECRO_ATTR LPH_UNROLL = __SECRO_ATTR SECRO_INLINE = __SECRO_ATTR LPH_INLINE = __SECRO_ATTR SECRO_TRANSFORM = __SECRO_ATTR LPH_TRANSFORM = __SECRO_ATTR SECRO_NONE = "NONE" SECRO_OPAL = "OPAL" SECRO_ONYX = "ONYX" SECRO_FAST = "FAST" SECRO_BALANCED = "BALANCED" SECRO_SECURE = "SECURE" SECRO_EXTRACT = "EXTRACT" SECRO_CONTROL_FLOW = "CONTROL_FLOW" SECRO_REWRITE_NAMECALLS = "REWRITE_NAMECALLS" SECRO_GLOBALS = "GLOBALS" SECRO_CONSTANTS = "CONSTANTS" LPH_NONE = SECRO_NONE LPH_OPAL = SECRO_OPAL LPH_ONYX = SECRO_ONYX LPH_FAST = SECRO_FAST LPH_BALANCED = SECRO_BALANCED LPH_SECURE = SECRO_SECURE LPH_EXTRACT = SECRO_EXTRACT LPH_CONTROL_FLOW = SECRO_CONTROL_FLOW LPH_REWRITE_NAMECALLS = SECRO_REWRITE_NAMECALLS LPH_GLOBALS = SECRO_GLOBALS LPH_CONSTANTS = SECRO_CONSTANTS local function __SECRO_STACKALLOC(size, base) base = base or 1 local allocation = {__size = size, __base = base, __end = base + size - 1} return setmetatable(allocation, { __index = function(self, key) if key == "__len" then return self.__size end if key == "clear" then return function(s, first, last) first, last = first or s.__base, last or s.__end for i = first, last do s[i] = nil end end end if key == "unpack" then return function(s, first, last) first, last = first or s.__base, last or s.__end return table.unpack(s, first, last) end end if key == "pack" then return function(s, first, last) first, last = first or s.__base, last or s.__end return table.pack and table.pack(table.unpack(s, first, last)) or {table.unpack(s, first, last)} end end end, }) end SECRO_STACKALLOC = __SECRO_STACKALLOC LPH_STACKALLOC = __SECRO_STACKALLOC -- SecroAuth loader local script_key = script_key or getgenv().script_key or "" local SCRIPT_ID = "dummy" local WS_URL = "wss://example.invalid/ws" if string.sub(WS_URL, 1, 6) ~= "wss://" then error("SecroAuth: secure websocket required") end local g_type, g_pcall, g_rawequal, g_tostring = type, pcall, rawequal, tostring local type, pcall, rawequal, tostring = g_type, g_pcall, g_rawequal, g_tostring local byte, char, concat = string.byte, string.char, table.concat local str_find, str_lower = string.find, string.lower local bxor, band, rshift, lshift = bit32.bxor, bit32.band, bit32.rshift, bit32.lshift local remove = table.remove local wait = task and task.wait local pcall_ref = g_pcall local getgenv_ref = getgenv local rawget_ref = rawget local getfenv_ref = getfenv local setfenv_ref = setfenv local env = getgenv and getgenv() or _G local global_ls = loadstring local env_ls = env and env.loadstring local dbg = debug local info_ref = dbg and (dbg.info or dbg.getinfo) local trace_ref = dbg and dbg.traceback local gethook_ref = dbg and dbg.gethook local dump_ref = string.dump local json_decode = game:GetService("HttpService").JSONDecode local HttpService = game:GetService("HttpService") local function native_loader(fn) if type(fn) ~= "function" then return false, "type" end local ok, chunk = pcall(fn, "return 0x5EC0A1") if not ok or type(chunk) ~= "function" then return false, "canary_load" end local ok2, value = pcall(chunk) if not ok2 or value ~= 0x5EC0A1 then return false, "canary_run" end if dump_ref then local dumped = pcall(dump_ref, fn) if dumped then return false, "dump" end end if info_ref then local got, info = pcall(info_ref, fn, "s") if got and info ~= nil then if type(info) == "string" and info ~= "[C]" then return false, "info" end if type(info) == "table" and info.what and info.what ~= "C" then return false, "info" end end end return true end local L = {} if env_ls and global_ls and not rawequal(env_ls, global_ls) then error("SecroAuth: loader identity mismatch") end local candidates = { global_ls, env_ls } if dbg and dbg.loadstring then candidates[#candidates + 1] = dbg.loadstring end for i = 1, #candidates do local fn = candidates[i] if not L.loader and native_loader(fn) then L.loader = fn end end if not L.loader then error("SecroAuth: environment check failed") end local function stable() local trusted = L.loader local ok, why = native_loader(trusted) if not ok then return "native:" .. tostring(why) end if global_ls and not rawequal(global_ls, loadstring) then return "global" end if env_ls and not rawequal(env_ls, env and env.loadstring) then return "env" end if info_ref and not rawequal(info_ref, dbg and (dbg.info or dbg.getinfo)) then return "info" end if dump_ref and not rawequal(dump_ref, string.dump) then return "dump" end if pcall_ref and env and env.pcall ~= nil and not rawequal(pcall_ref, env.pcall) then return "pcall" end if getgenv_ref and not rawequal(getgenv_ref, getgenv) then return "getgenv" end if getfenv_ref and not rawequal(getfenv_ref, getfenv) then return "getfenv" end if setfenv_ref and not rawequal(setfenv_ref, setfenv) then return "setfenv" end if rawget_ref and not rawequal(rawget_ref, rawget) then return "rawget" end if not rawequal(byte, string.byte) or not rawequal(char, string.char) or not rawequal(str_find, string.find) or not rawequal(str_lower, string.lower) then return "string" end if not rawequal(concat, table.concat) or not rawequal(remove, table.remove) then return "table" end if not rawequal(bxor, bit32.bxor) then return "bit32" end return nil end -- Conservative harness detector. Only strong test-framework signatures are -- fatal. Executor globals (getgenv/hookfunction/...) are expected and are -- intentionally not considered here. local function harness_probe() local markers = { "busted", "luassert", "TestEZ", "__TESTEZ_RUNNING", "__HARNESS__", "jest", "mocha", "chai", "sinon", } for i = 1, #markers do local name = markers[i] local ok, value = pcall(function() return env[name] end) if ok and value ~= nil then return "instrumentation:" .. name end end if trace_ref then local ok, tb = pcall(trace_ref, "", 2) if ok and type(tb) == "string" and #tb > 0 then local low = str_lower(tb) local needles = { "busted", "luassert", "testez", "__harness__", "jest", "mocha", "chai", "sinon", } for i = 1, #needles do if str_find(low, needles[i], 1, true) then return "instrumentation:" .. needles[i] end end end end if gethook_ref then local ok, hook = pcall(gethook_ref) if ok and hook ~= nil and info_ref then local ok2, src = pcall(info_ref, hook, "s") if ok2 and type(src) == "string" then local low = str_lower(src) if str_find(low, "busted", 1, true) or str_find(low, "luassert", 1, true) or str_find(low, "testez", 1, true) or str_find(low, "__harness__", 1, true) then return "instrumentation:hook" end end end end return nil end local B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" local B64R = {} for i = 1, #B64 do B64R[byte(B64, i)] = i - 1 end local function b64(s, expected_len) local out, cur, cn = {}, {}, 0 local len = #s local i = 1 local next_yield = 262144 -- Four input characters produce three output bytes. Decoding in one -- operation per character pair is what keeps this loop fast on mobile. while i + 3 <= len do local b1, b2, b3, b4 = byte(s, i, i + 3) if b2 == 61 or b3 == 61 or b4 == 61 then break end local v1, v2, v3, v4 = B64R[b1], B64R[b2], B64R[b3], B64R[b4] if v1 and v2 and v3 and v4 then local x = v1 * 262144 + v2 * 4096 + v3 * 64 + v4 cn = cn + 1 cur[cn] = char(band(rshift(x, 16), 255), band(rshift(x, 8), 255), band(x, 255)) if cn >= 4096 then out[#out + 1] = concat(cur) cur = {} cn = 0 end end i = i + 4 if wait and i >= next_yield then wait(0) next_yield = next_yield + 262144 end end local acc, bits = 0, 0 while i <= len do local c = byte(s, i) if c == 61 then break end local v = B64R[c] if v then acc = acc * 64 + v bits = bits + 6 if bits >= 8 then bits = bits - 8 cn = cn + 1 cur[cn] = char(band(rshift(acc, bits), 255)) acc = band(acc, lshift(1, bits) - 1) end end i = i + 1 end out[#out + 1] = concat(cur) local result = concat(out) if expected_len and #result ~= expected_len then return nil end return result end local buffer_lib = type(buffer) == "table" and type(buffer.fromstring) == "function" and type(buffer.create) == "function" and type(buffer.tostring) == "function" and type(buffer.readu32) == "function" and type(buffer.writeu32) == "function" and type(buffer.readu8) == "function" and type(buffer.writeu8) == "function" and buffer or nil local make_ks64 = __SECRO_NATIVE("function(key)\n local ks = {}\n for lb = 0, 511 do\n local idx = ((lb % 256) - 1) % 32 + 1\n ks[lb + 1] = char(band(bxor(byte(key, idx), band(lb, 255)), 255))\n end\n local kss = concat(ks)\n local ksb = buffer_lib.fromstring(kss)\n local out = buffer_lib.create(65536)\n local p = 1\n while p <= 65536 do\n local lo = p % 256\n local hi = band(rshift(p, 8), 255)\n local hi2 = band(rshift(p + 3, 8), 255)\n if hi == hi2 then\n local hi4 = hi + hi * 256 + hi * 65536 + hi * 16777216\n buffer_lib.writeu32(out, p - 1,\n bxor(buffer_lib.readu32(ksb, lo), hi4))\n else\n for q = p, p + 3 do\n buffer_lib.writeu8(out, q - 1,\n bxor(byte(kss, (q % 256) + 1), band(rshift(q, 8), 255)))\n end\n end\n p = p + 4\n end\n return buffer_lib.tostring(out)\nend",{["__SECRO_NATIVE"]={function() return __SECRO_NATIVE end,function(__secro_value) __SECRO_NATIVE=__secro_value end},["band"]={function() return band end,function(__secro_value) band=__secro_value end},["buffer_lib"]={function() return buffer_lib end,function(__secro_value) buffer_lib=__secro_value end},["bxor"]={function() return bxor end,function(__secro_value) bxor=__secro_value end},["byte"]={function() return byte end,function(__secro_value) byte=__secro_value end},["char"]={function() return char end,function(__secro_value) char=__secro_value end},["concat"]={function() return concat end,function(__secro_value) concat=__secro_value end},["create"]={function() return create end,function(__secro_value) create=__secro_value end},["fromstring"]={function() return fromstring end,function(__secro_value) fromstring=__secro_value end},["hi"]={function() return hi end,function(__secro_value) hi=__secro_value end},["hi2"]={function() return hi2 end,function(__secro_value) hi2=__secro_value end},["hi4"]={function() return hi4 end,function(__secro_value) hi4=__secro_value end},["idx"]={function() return idx end,function(__secro_value) idx=__secro_value end},["key"]={function() return key end,function(__secro_value) key=__secro_value end},["ks"]={function() return ks end,function(__secro_value) ks=__secro_value end},["ksb"]={function() return ksb end,function(__secro_value) ksb=__secro_value end},["kss"]={function() return kss end,function(__secro_value) kss=__secro_value end},["lb"]={function() return lb end,function(__secro_value) lb=__secro_value end},["lo"]={function() return lo end,function(__secro_value) lo=__secro_value end},["out"]={function() return out end,function(__secro_value) out=__secro_value end},["p"]={function() return p end,function(__secro_value) p=__secro_value end},["q"]={function() return q end,function(__secro_value) q=__secro_value end},["readu32"]={function() return readu32 end,function(__secro_value) readu32=__secro_value end},["rshift"]={function() return rshift end,function(__secro_value) rshift=__secro_value end},["tostring"]={function() return tostring end,function(__secro_value) tostring=__secro_value end},["writeu32"]={function() return writeu32 end,function(__secro_value) writeu32=__secro_value end},["writeu8"]={function() return writeu8 end,function(__secro_value) writeu8=__secro_value end}}) local decrypt_buf = __SECRO_NATIVE("function(s, key, ks)\n local n = #s\n local src = buffer_lib.fromstring(s)\n local dst = buffer_lib.create(n)\n local ksb = buffer_lib.fromstring(ks)\n local off, ko = 0, 0\n local next_yield = 262144\n while off + 64 <= n do\n local a1 = buffer_lib.readu32(src, off)\n local a2 = buffer_lib.readu32(src, off + 4)\n local a3 = buffer_lib.readu32(src, off + 8)\n local a4 = buffer_lib.readu32(src, off + 12)\n local a5 = buffer_lib.readu32(src, off + 16)\n local a6 = buffer_lib.readu32(src, off + 20)\n local a7 = buffer_lib.readu32(src, off + 24)\n local a8 = buffer_lib.readu32(src, off + 28)\n local a9 = buffer_lib.readu32(src, off + 32)\n local a10 = buffer_lib.readu32(src, off + 36)\n local a11 = buffer_lib.readu32(src, off + 40)\n local a12 = buffer_lib.readu32(src, off + 44)\n local a13 = buffer_lib.readu32(src, off + 48)\n local a14 = buffer_lib.readu32(src, off + 52)\n local a15 = buffer_lib.readu32(src, off + 56)\n local a16 = buffer_lib.readu32(src, off + 60)\n local k1 = buffer_lib.readu32(ksb, ko)\n local k2 = buffer_lib.readu32(ksb, ko + 4)\n local k3 = buffer_lib.readu32(ksb, ko + 8)\n local k4 = buffer_lib.readu32(ksb, ko + 12)\n local k5 = buffer_lib.readu32(ksb, ko + 16)\n local k6 = buffer_lib.readu32(ksb, ko + 20)\n local k7 = buffer_lib.readu32(ksb, ko + 24)\n local k8 = buffer_lib.readu32(ksb, ko + 28)\n local k9 = buffer_lib.readu32(ksb, ko + 32)\n local k10 = buffer_lib.readu32(ksb, ko + 36)\n local k11 = buffer_lib.readu32(ksb, ko + 40)\n local k12 = buffer_lib.readu32(ksb, ko + 44)\n local k13 = buffer_lib.readu32(ksb, ko + 48)\n local k14 = buffer_lib.readu32(ksb, ko + 52)\n local k15 = buffer_lib.readu32(ksb, ko + 56)\n local k16 = buffer_lib.readu32(ksb, ko + 60)\n buffer_lib.writeu32(dst, off, bxor(a1, k1))\n buffer_lib.writeu32(dst, off + 4, bxor(a2, k2))\n buffer_lib.writeu32(dst, off + 8, bxor(a3, k3))\n buffer_lib.writeu32(dst, off + 12, bxor(a4, k4))\n buffer_lib.writeu32(dst, off + 16, bxor(a5, k5))\n buffer_lib.writeu32(dst, off + 20, bxor(a6, k6))\n buffer_lib.writeu32(dst, off + 24, bxor(a7, k7))\n buffer_lib.writeu32(dst, off + 28, bxor(a8, k8))\n buffer_lib.writeu32(dst, off + 32, bxor(a9, k9))\n buffer_lib.writeu32(dst, off + 36, bxor(a10, k10))\n buffer_lib.writeu32(dst, off + 40, bxor(a11, k11))\n buffer_lib.writeu32(dst, off + 44, bxor(a12, k12))\n buffer_lib.writeu32(dst, off + 48, bxor(a13, k13))\n buffer_lib.writeu32(dst, off + 52, bxor(a14, k14))\n buffer_lib.writeu32(dst, off + 56, bxor(a15, k15))\n buffer_lib.writeu32(dst, off + 60, bxor(a16, k16))\n off = off + 64\n ko = ko + 64\n if ko >= 65536 then\n ko = 0\n end\n if wait and off >= next_yield then\n wait(0)\n next_yield = next_yield + 262144\n end\n end\n while off + 16 <= n do\n local a1 = buffer_lib.readu32(src, off)\n local a2 = buffer_lib.readu32(src, off + 4)\n local a3 = buffer_lib.readu32(src, off + 8)\n local a4 = buffer_lib.readu32(src, off + 12)\n local k1 = buffer_lib.readu32(ksb, ko)\n local k2 = buffer_lib.readu32(ksb, ko + 4)\n local k3 = buffer_lib.readu32(ksb, ko + 8)\n local k4 = buffer_lib.readu32(ksb, ko + 12)\n buffer_lib.writeu32(dst, off, bxor(a1, k1))\n buffer_lib.writeu32(dst, off + 4, bxor(a2, k2))\n buffer_lib.writeu32(dst, off + 8, bxor(a3, k3))\n buffer_lib.writeu32(dst, off + 12, bxor(a4, k4))\n off = off + 16\n ko = ko + 16\n if ko >= 65536 then\n ko = 0\n end\n end\n while off + 4 <= n do\n buffer_lib.writeu32(dst, off,\n bxor(buffer_lib.readu32(src, off), buffer_lib.readu32(ksb, ko)))\n off = off + 4\n ko = ko + 4\n if ko >= 65536 then\n ko = 0\n end\n end\n while off < n do\n buffer_lib.writeu8(dst, off,\n bxor(buffer_lib.readu8(src, off), buffer_lib.readu8(ksb, ko)))\n off = off + 1\n ko = ko + 1\n if ko >= 65536 then\n ko = 0\n end\n end\n return buffer_lib.tostring(dst)\nend",{["__SECRO_NATIVE"]={function() return __SECRO_NATIVE end,function(__secro_value) __SECRO_NATIVE=__secro_value end},["a1"]={function() return a1 end,function(__secro_value) a1=__secro_value end},["a10"]={function() return a10 end,function(__secro_value) a10=__secro_value end},["a11"]={function() return a11 end,function(__secro_value) a11=__secro_value end},["a12"]={function() return a12 end,function(__secro_value) a12=__secro_value end},["a13"]={function() return a13 end,function(__secro_value) a13=__secro_value end},["a14"]={function() return a14 end,function(__secro_value) a14=__secro_value end},["a15"]={function() return a15 end,function(__secro_value) a15=__secro_value end},["a16"]={function() return a16 end,function(__secro_value) a16=__secro_value end},["a2"]={function() return a2 end,function(__secro_value) a2=__secro_value end},["a3"]={function() return a3 end,function(__secro_value) a3=__secro_value end},["a4"]={function() return a4 end,function(__secro_value) a4=__secro_value end},["a5"]={function() return a5 end,function(__secro_value) a5=__secro_value end},["a6"]={function() return a6 end,function(__secro_value) a6=__secro_value end},["a7"]={function() return a7 end,function(__secro_value) a7=__secro_value end},["a8"]={function() return a8 end,function(__secro_value) a8=__secro_value end},["a9"]={function() return a9 end,function(__secro_value) a9=__secro_value end},["buffer_lib"]={function() return buffer_lib end,function(__secro_value) buffer_lib=__secro_value end},["bxor"]={function() return bxor end,function(__secro_value) bxor=__secro_value end},["create"]={function() return create end,function(__secro_value) create=__secro_value end},["dst"]={function() return dst end,function(__secro_value) dst=__secro_value end},["fromstring"]={function() return fromstring end,function(__secro_value) fromstring=__secro_value end},["k1"]={function() return k1 end,function(__secro_value) k1=__secro_value end},["k10"]={function() return k10 end,function(__secro_value) k10=__secro_value end},["k11"]={function() return k11 end,function(__secro_value) k11=__secro_value end},["k12"]={function() return k12 end,function(__secro_value) k12=__secro_value end},["k13"]={function() return k13 end,function(__secro_value) k13=__secro_value end},["k14"]={function() return k14 end,function(__secro_value) k14=__secro_value end},["k15"]={function() return k15 end,function(__secro_value) k15=__secro_value end},["k16"]={function() return k16 end,function(__secro_value) k16=__secro_value end},["k2"]={function() return k2 end,function(__secro_value) k2=__secro_value end},["k3"]={function() return k3 end,function(__secro_value) k3=__secro_value end},["k4"]={function() return k4 end,function(__secro_value) k4=__secro_value end},["k5"]={function() return k5 end,function(__secro_value) k5=__secro_value end},["k6"]={function() return k6 end,function(__secro_value) k6=__secro_value end},["k7"]={function() return k7 end,function(__secro_value) k7=__secro_value end},["k8"]={function() return k8 end,function(__secro_value) k8=__secro_value end},["k9"]={function() return k9 end,function(__secro_value) k9=__secro_value end},["key"]={function() return key end,function(__secro_value) key=__secro_value end},["ko"]={function() return ko end,function(__secro_value) ko=__secro_value end},["ks"]={function() return ks end,function(__secro_value) ks=__secro_value end},["ksb"]={function() return ksb end,function(__secro_value) ksb=__secro_value end},["n"]={function() return n end,function(__secro_value) n=__secro_value end},["next_yield"]={function() return next_yield end,function(__secro_value) next_yield=__secro_value end},["off"]={function() return off end,function(__secro_value) off=__secro_value end},["readu32"]={function() return readu32 end,function(__secro_value) readu32=__secro_value end},["readu8"]={function() return readu8 end,function(__secro_value) readu8=__secro_value end},["s"]={function() return s end,function(__secro_value) s=__secro_value end},["src"]={function() return src end,function(__secro_value) src=__secro_value end},["tostring"]={function() return tostring end,function(__secro_value) tostring=__secro_value end},["wait"]={function() return wait end,function(__secro_value) wait=__secro_value end},["writeu32"]={function() return writeu32 end,function(__secro_value) writeu32=__secro_value end},["writeu8"]={function() return writeu8 end,function(__secro_value) writeu8=__secro_value end}}) local decrypt_fast = __SECRO_NATIVE("function(s, key)\n local n = #s\n local out, cur, cn = {}, {}, 0\n local ks = {}\n for lb = 0, 511 do\n local idx = ((lb % 256) - 1) % 32 + 1\n ks[lb + 1] = char(band(bxor(byte(key, idx), band(lb, 255)), 255))\n end\n local kss = concat(ks)\n local i = 1\n local next_yield = 262144\n while i + 15 <= n do\n local lo = i % 256\n local hi = band(rshift(i, 8), 255)\n local hi2 = band(rshift(i + 15, 8), 255)\n if hi == hi2 then\n local b1, b2, b3, b4, b5, b6, b7, b8,\n b9, b10, b11, b12, b13, b14, b15, b16 = byte(s, i, i + 15)\n local k1, k2, k3, k4, k5, k6, k7, k8,\n k9, k10, k11, k12, k13, k14, k15, k16 = byte(kss, lo + 1, lo + 16)\n cn = cn + 1\n cur[cn] = char(\n bxor(b1, k1, hi), bxor(b2, k2, hi), bxor(b3, k3, hi), bxor(b4, k4, hi),\n bxor(b5, k5, hi), bxor(b6, k6, hi), bxor(b7, k7, hi), bxor(b8, k8, hi),\n bxor(b9, k9, hi), bxor(b10, k10, hi), bxor(b11, k11, hi), bxor(b12, k12, hi),\n bxor(b13, k13, hi), bxor(b14, k14, hi), bxor(b15, k15, hi), bxor(b16, k16, hi))\n else\n for p = i, i + 15 do\n cn = cn + 1\n cur[cn] = char(bxor(byte(s, p), byte(kss, (p % 256) + 1),\n band(rshift(p, 8), 255)))\n end\n end\n i = i + 16\n if cn >= 4096 then\n out[#out + 1] = concat(cur)\n cur = {}\n cn = 0\n end\n if wait and i >= next_yield then\n wait(0)\n next_yield = next_yield + 262144\n end\n end\n while i <= n do\n cn = cn + 1\n cur[cn] = char(bxor(byte(s, i), byte(kss, (i % 256) + 1),\n band(rshift(i, 8), 255)))\n i = i + 1\n end\n out[#out + 1] = concat(cur)\n return concat(out)\nend",{["__SECRO_NATIVE"]={function() return __SECRO_NATIVE end,function(__secro_value) __SECRO_NATIVE=__secro_value end},["b1"]={function() return b1 end,function(__secro_value) b1=__secro_value end},["b10"]={function() return b10 end,function(__secro_value) b10=__secro_value end},["b11"]={function() return b11 end,function(__secro_value) b11=__secro_value end},["b12"]={function() return b12 end,function(__secro_value) b12=__secro_value end},["b13"]={function() return b13 end,function(__secro_value) b13=__secro_value end},["b14"]={function() return b14 end,function(__secro_value) b14=__secro_value end},["b15"]={function() return b15 end,function(__secro_value) b15=__secro_value end},["b16"]={function() return b16 end,function(__secro_value) b16=__secro_value end},["b2"]={function() return b2 end,function(__secro_value) b2=__secro_value end},["b3"]={function() return b3 end,function(__secro_value) b3=__secro_value end},["b4"]={function() return b4 end,function(__secro_value) b4=__secro_value end},["b5"]={function() return b5 end,function(__secro_value) b5=__secro_value end},["b6"]={function() return b6 end,function(__secro_value) b6=__secro_value end},["b7"]={function() return b7 end,function(__secro_value) b7=__secro_value end},["b8"]={function() return b8 end,function(__secro_value) b8=__secro_value end},["b9"]={function() return b9 end,function(__secro_value) b9=__secro_value end},["band"]={function() return band end,function(__secro_value) band=__secro_value end},["bxor"]={function() return bxor end,function(__secro_value) bxor=__secro_value end},["byte"]={function() return byte end,function(__secro_value) byte=__secro_value end},["char"]={function() return char end,function(__secro_value) char=__secro_value end},["cn"]={function() return cn end,function(__secro_value) cn=__secro_value end},["concat"]={function() return concat end,function(__secro_value) concat=__secro_value end},["cur"]={function() return cur end,function(__secro_value) cur=__secro_value end},["hi"]={function() return hi end,function(__secro_value) hi=__secro_value end},["hi2"]={function() return hi2 end,function(__secro_value) hi2=__secro_value end},["i"]={function() return i end,function(__secro_value) i=__secro_value end},["idx"]={function() return idx end,function(__secro_value) idx=__secro_value end},["k1"]={function() return k1 end,function(__secro_value) k1=__secro_value end},["k10"]={function() return k10 end,function(__secro_value) k10=__secro_value end},["k11"]={function() return k11 end,function(__secro_value) k11=__secro_value end},["k12"]={function() return k12 end,function(__secro_value) k12=__secro_value end},["k13"]={function() return k13 end,function(__secro_value) k13=__secro_value end},["k14"]={function() return k14 end,function(__secro_value) k14=__secro_value end},["k15"]={function() return k15 end,function(__secro_value) k15=__secro_value end},["k16"]={function() return k16 end,function(__secro_value) k16=__secro_value end},["k2"]={function() return k2 end,function(__secro_value) k2=__secro_value end},["k3"]={function() return k3 end,function(__secro_value) k3=__secro_value end},["k4"]={function() return k4 end,function(__secro_value) k4=__secro_value end},["k5"]={function() return k5 end,function(__secro_value) k5=__secro_value end},["k6"]={function() return k6 end,function(__secro_value) k6=__secro_value end},["k7"]={function() return k7 end,function(__secro_value) k7=__secro_value end},["k8"]={function() return k8 end,function(__secro_value) k8=__secro_value end},["k9"]={function() return k9 end,function(__secro_value) k9=__secro_value end},["key"]={function() return key end,function(__secro_value) key=__secro_value end},["ks"]={function() return ks end,function(__secro_value) ks=__secro_value end},["kss"]={function() return kss end,function(__secro_value) kss=__secro_value end},["lb"]={function() return lb end,function(__secro_value) lb=__secro_value end},["lo"]={function() return lo end,function(__secro_value) lo=__secro_value end},["n"]={function() return n end,function(__secro_value) n=__secro_value end},["next_yield"]={function() return next_yield end,function(__secro_value) next_yield=__secro_value end},["out"]={function() return out end,function(__secro_value) out=__secro_value end},["p"]={function() return p end,function(__secro_value) p=__secro_value end},["rshift"]={function() return rshift end,function(__secro_value) rshift=__secro_value end},["s"]={function() return s end,function(__secro_value) s=__secro_value end},["wait"]={function() return wait end,function(__secro_value) wait=__secro_value end}}) local decrypt = __SECRO_NATIVE("function(s, key)\n if #key == 0 then\n return nil\n end\n if buffer_lib then\n local ok, out = pcall(function()\n return decrypt_buf(s, key, make_ks64(key))\n end)\n if ok and type(out) == \"string\" and #out == #s then\n return out\n end\n end\n return decrypt_fast(s, key)\nend",{["__SECRO_NATIVE"]={function() return __SECRO_NATIVE end,function(__secro_value) __SECRO_NATIVE=__secro_value end},["buffer_lib"]={function() return buffer_lib end,function(__secro_value) buffer_lib=__secro_value end},["decrypt_buf"]={function() return decrypt_buf end,function(__secro_value) decrypt_buf=__secro_value end},["decrypt_fast"]={function() return decrypt_fast end,function(__secro_value) decrypt_fast=__secro_value end},["key"]={function() return key end,function(__secro_value) key=__secro_value end},["make_ks64"]={function() return make_ks64 end,function(__secro_value) make_ks64=__secro_value end},["ok"]={function() return ok end,function(__secro_value) ok=__secro_value end},["out"]={function() return out end,function(__secro_value) out=__secro_value end},["pcall"]={function() return pcall end,function(__secro_value) pcall=__secro_value end},["s"]={function() return s end,function(__secro_value) s=__secro_value end},["type"]={function() return type end,function(__secro_value) type=__secro_value end}}) local sample = __SECRO_NATIVE("function(s)\n local h = 0\n for i = 1, #s, 128 do\n h = band(bxor(h * 33, byte(s, i)), 0xFFFFFFFF)\n end\n return h\nend",{["__SECRO_NATIVE"]={function() return __SECRO_NATIVE end,function(__secro_value) __SECRO_NATIVE=__secro_value end},["band"]={function() return band end,function(__secro_value) band=__secro_value end},["bxor"]={function() return bxor end,function(__secro_value) bxor=__secro_value end},["byte"]={function() return byte end,function(__secro_value) byte=__secro_value end},["h"]={function() return h end,function(__secro_value) h=__secro_value end},["i"]={function() return i end,function(__secro_value) i=__secro_value end},["s"]={function() return s end,function(__secro_value) s=__secro_value end}}) local function executor_name() local ok, name = pcall(function() if identifyexecutor then return identifyexecutor() end if getexecutorname then return getexecutorname() end if syn and syn.identifyexecutor then return syn:identifyexecutor() end if fluxus and fluxus.identifyexecutor then return fluxus:identifyexecutor() end if is_sirhurt_closure then return "SirHurt" end if Delta then return "Delta" end if Krnl or KRNL then return "Krnl" end return nil end) if ok and name and tostring(name) ~= "" then return tostring(name):sub(1, 80) end return "Unknown" end local function hwid() local values = {} local function add(fn) if type(fn) == "function" then local ok, value = pcall(fn) if ok and value ~= nil then values[#values + 1] = tostring(value) end end end add(gethwid) add(get_hwid) add(getdeviceid) add(get_device_id) if syn and syn.get_hwid then add(function() return syn:get_hwid() end) end if fluxus and fluxus.get_hwid then add(function() return fluxus:get_hwid() end) end for i = 1, #values do local value = tostring(values[i]) if value ~= "" and value ~= "0" and value ~= "nil" and value ~= "unknown" and #value <= 200 then return value end end error("SecroAuth: hardware ID unavailable on this executor") end local band, bor, bxor, brshift, blshift, bnot = bit32.band, bit32.bor, bit32.bxor, bit32.rshift, bit32.lshift, bit32.bnot local byte, char, concat, rep = string.byte, string.char, table.concat, string.rep local floor = math.floor local K = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, } local function add(...) local s = 0 for i = 1, select("#", ...) do s = (s + select(i, ...)) % 4294967296 end return s end local function ror(x, n) n = n % 32 if n == 0 then return x end return bor(brshift(x, n), blshift(x, 32 - n)) end local function sha256(message) local data = {} for i = 1, #message do data[i] = byte(message, i) end local bitlen = #message * 8 data[#data + 1] = 0x80 while (#data % 64) ~= 56 do data[#data + 1] = 0 end local high = floor(bitlen / 4294967296) local low = bitlen % 4294967296 local function push32(n) data[#data + 1] = floor(n / 16777216) % 256 data[#data + 1] = floor(n / 65536) % 256 data[#data + 1] = floor(n / 256) % 256 data[#data + 1] = n % 256 end push32(high) push32(low) local h0, h1, h2, h3 = 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a local h4, h5, h6, h7 = 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 for base = 1, #data, 64 do local w = {} for i = 0, 15 do local j = base + i * 4 w[i] = ((data[j] * 256 + data[j + 1]) * 256 + data[j + 2]) * 256 + data[j + 3] end for i = 16, 63 do local x = w[i - 15] local y = w[i - 2] local s0 = bxor(ror(x, 7), ror(x, 18), brshift(x, 3)) local s1 = bxor(ror(y, 17), ror(y, 19), brshift(y, 10)) w[i] = add(w[i - 16], s0, w[i - 7], s1) end local a, b, c, d, e, f, g, h = h0, h1, h2, h3, h4, h5, h6, h7 for i = 0, 63 do local S1 = bxor(ror(e, 6), ror(e, 11), ror(e, 25)) local ch = bxor(band(e, f), band(bnot(e), g)) local t1 = add(h, S1, ch, K[i + 1], w[i]) local S0 = bxor(ror(a, 2), ror(a, 13), ror(a, 22)) local maj = bxor(band(a, b), band(a, c), band(b, c)) local t2 = add(S0, maj) h, g, f, e, d, c, b, a = g, f, e, add(d, t1), c, b, a, add(t1, t2) end h0, h1, h2, h3 = add(h0, a), add(h1, b), add(h2, c), add(h3, d) h4, h5, h6, h7 = add(h4, e), add(h5, f), add(h6, g), add(h7, h) end local out = {} local function push(n) out[#out + 1] = char(floor(n / 16777216) % 256, floor(n / 65536) % 256, floor(n / 256) % 256, n % 256) end push(h0); push(h1); push(h2); push(h3) push(h4); push(h5); push(h6); push(h7) return concat(out) end local HEX = "0123456789abcdef" local function tohex(s) local out = {} for i = 1, #s do local b = byte(s, i) local hi = floor(b / 16) + 1 local lo = b % 16 + 1 out[#out + 1] = string.sub(HEX, hi, hi) .. string.sub(HEX, lo, lo) end return concat(out) end local function fromhex(s) local out = {} for i = 1, #s, 2 do out[#out + 1] = char(tonumber(string.sub(s, i, i + 1), 16)) end return concat(out) end local function hmac(key, message) if #key > 64 then key = sha256(key) end key = key .. rep("\0", 64 - #key) local ipad, opad = {}, {} for i = 1, 64 do local b = byte(key, i) ipad[i] = char(bxor(b, 0x36)) opad[i] = char(bxor(b, 0x5c)) end return sha256(concat(opad) .. sha256(concat(ipad) .. message)) end local function __sha256hex(message) return tohex(sha256(message)) end local function __hmachex(key, message) return tohex(hmac(key, message)) end -- PRF-based KDF. The license key is already a uniformly random 190-bit -- secret, so a single labelled HMAC is sufficient and avoids a binary-key -- HKDF path that the protected VM handles poorly. local function __kdf(key, salt, info) return hmac(key, info .. "|" .. salt) end local function __random(n) local ok, value = pcall(function() if crypt and crypt.generatebytes then return crypt.generatebytes(n) end if crypt and crypt.random then return crypt.random(n) end if syn and syn.crypt and syn.crypt.generatebytes then return syn.crypt.generatebytes(n) end if fluxus and fluxus.crypt and fluxus.crypt.generatebytes then return fluxus.crypt.generatebytes(n) end return nil end) if ok and type(value) == "string" and #value >= n then return string.sub(value, 1, n) end local seed = tostring(os.clock()) .. tostring(os.time()) .. tostring({}) .. tostring(math.random()) local out = "" while #out < n do seed = sha256(seed) .. seed out = out .. seed end return string.sub(out, 1, n) end local function __randomhex(n) return tohex(__random(n)) end local __why = stable() if __why then error("SecroAuth: integrity check failed (" .. __why .. ")") end local __harness = harness_probe() if __harness then error("SecroAuth: " .. __harness) end local okws, ws = pcall(WebSocket.connect, WS_URL) if not okws or not ws then error("SecroAuth: websocket unavailable") end local queue = {} local S = {closed = false, closed_at = nil} local events = false if ws.OnMessage then local okc = pcall(function() ws.OnMessage:Connect(function(message) queue[#queue + 1] = message end) end) events = okc end if ws.OnClose then pcall(function() ws.OnClose:Connect(function() S.closed = true S.closed_at = os.clock() end) end) end if not events then error("SecroAuth: websocket events unavailable") end local function read_one(deadline) while true do local raw = remove(queue, 1) if raw then local ok, data = pcall(json_decode, HttpService, raw) if ok and type(data) == "table" then return data end else if S.closed then error("SecroAuth: connection closed during handshake") end if os.clock() > deadline then error("SecroAuth: handshake timeout") end task.wait(0.02) end end end local hello = read_one(os.clock() + 30) local nonce = tostring(hello.nonce or "") local hello_ts = tostring(hello.ts or "") local proto = tostring(hello.v or "") local hs_session = tostring(hello.session_id or "") if hello.type ~= "hello" or (proto ~= "3" and proto ~= "4") or nonce == "" then error("SecroAuth: invalid hello") end if proto == "4" and hs_session == "" then error("SecroAuth: invalid session") end local hwid_value = hwid() local executor_value = executor_name() local client_ts = tostring(os.time()) local client_nonce = tohex(__random(16)) local key_id = __sha256hex(script_key) local auth_salt local auth_text if proto == "4" then auth_salt = SCRIPT_ID .. ":" .. nonce .. ":" .. hs_session .. ":" .. client_nonce auth_text = "v4|auth|" .. SCRIPT_ID .. "|" .. nonce .. "|" .. hello_ts .. "|" .. client_ts .. "|" .. client_nonce .. "|" .. key_id .. "|" .. hwid_value .. "|" .. executor_value .. "|" .. hs_session else auth_salt = SCRIPT_ID .. ":" .. nonce .. ":" .. client_nonce auth_text = "v3|auth|" .. SCRIPT_ID .. "|" .. nonce .. "|" .. hello_ts .. "|" .. client_ts .. "|" .. client_nonce .. "|" .. key_id .. "|" .. hwid_value .. "|" .. executor_value end ws:Send(HttpService:JSONEncode({ type = "auth", v = proto == "4" and 4 or 3, nonce = nonce, hello_ts = hello_ts, ts = client_ts, cnonce = client_nonce, key_id = key_id, proof = __hmachex(script_key, auth_text), hwid = hwid_value, executor = executor_value, session_id = proto == "4" and hs_session or nil, })) local enc_data = "" local binary_mode = false local k_auth = __kdf(script_key, auth_salt, proto == "4" and "secro-auth-v4" or "secro-auth-v3") local k_wrap = nil local k_enc = "" local key_fp = "" if proto == "4" then k_wrap = __kdf(script_key, auth_salt, "secro-session-wrap-v4") else k_enc = __kdf(script_key, auth_salt, "secro-artifact-v3") end local session_id = "" local expected_check = nil local expected_len = nil local deadline = os.clock() + 60 while true do local raw = remove(queue, 1) if not raw then if S.closed then S.closed_at = S.closed_at or os.clock() if os.clock() - S.closed_at > 2 then error("SecroAuth: connection closed q=" .. tostring(#queue)) end end if os.clock() > deadline then error("SecroAuth: timeout") end task.wait(0.02) else local handled = false if type(raw) == "string" then local tag = string.sub(raw, 1, 2) if tag == "\0P" then pcall(function() ws:Send('{"type":"bin_ack"}') end) handled = true elseif tag == "\0C" then binary_mode = true enc_data = enc_data .. string.sub(raw, 3) handled = true end end if not handled then local ok, data = pcall(json_decode, HttpService, raw) if ok and type(data) == "table" then if data.type == "chunk" then enc_data = enc_data .. tostring(data.data or "") elseif data.type == "auth_ok" then session_id = tostring(data.session_id or "") expected_check = tonumber(data.check) expected_len = tonumber(data.len) if proto == "4" then key_fp = tostring(data.key_fp or "") local text = "v4|auth_ok|" .. SCRIPT_ID .. "|" .. nonce .. "|" .. hello_ts .. "|" .. client_ts .. "|" .. client_nonce .. "|" .. key_id .. "|" .. hwid_value .. "|" .. executor_value .. "|" .. session_id .. "|" .. tostring(expected_len) .. "|" .. tostring(expected_check) .. "|" .. key_fp if __hmachex(k_auth, text) ~= tostring(data.sig or "") then error("SecroAuth: auth signature failed") end local wrapped = b64(tostring(data.key_wrap or ""), 32) local unwrapped = decrypt(wrapped, k_wrap) if not unwrapped or #unwrapped ~= 32 then error("SecroAuth: session key failed") end local fp = __hmachex(unwrapped, "secro-session-fp-v4|" .. session_id) if fp ~= key_fp then error("SecroAuth: session fingerprint failed") end k_enc = unwrapped else local text = "v3|auth_ok|" .. SCRIPT_ID .. "|" .. nonce .. "|" .. hello_ts .. "|" .. client_ts .. "|" .. client_nonce .. "|" .. key_id .. "|" .. hwid_value .. "|" .. executor_value .. "|" .. session_id .. "|" .. tostring(expected_len) .. "|" .. tostring(expected_check) if __hmachex(k_auth, text) ~= tostring(data.sig or "") then error("SecroAuth: auth signature failed") end end elseif data.type == "done" then local text if proto == "4" then text = "v4|done|" .. SCRIPT_ID .. "|" .. nonce .. "|" .. client_nonce .. "|" .. session_id .. "|" .. tostring(expected_len) .. "|" .. tostring(expected_check) .. "|" .. key_fp else text = "v3|done|" .. SCRIPT_ID .. "|" .. nonce .. "|" .. client_nonce .. "|" .. session_id .. "|" .. tostring(expected_len) .. "|" .. tostring(expected_check) end if __hmachex(k_auth, text) ~= tostring(data.sig or "") then error("SecroAuth: done signature failed") end break elseif data.type == "error" then pcall(function() ws:Close() end) error("SecroAuth: " .. tostring(data.msg or data.code or "denied")) end end end end end pcall(function() ws:Close() end) if #k_enc == 0 or session_id == "" or not expected_check or not expected_len then error("SecroAuth: incomplete stream") end local encrypted if binary_mode then encrypted = enc_data else encrypted = b64(enc_data, expected_len) end if type(encrypted) ~= "string" or #encrypted ~= expected_len then error("SecroAuth: stream length mismatch") end local source = decrypt(encrypted, k_enc) if not source or #source ~= expected_len then error("SecroAuth: stream decrypt failed") end if sample(source) ~= expected_check then error("SecroAuth: stream integrity failed") end __why = stable() if __why then error("SecroAuth: loader changed (" .. __why .. ")") end local loaded, chunk = pcall(L.loader, source) if not loaded or type(chunk) ~= "function" then error("SecroAuth: load failed") end getgenv().script_key = script_key local ok, err = pcall(chunk) if not ok then error(err) end