--[[ SolaraAPIPack]] local Pack = { Version = "2.1.1", Name = "SolaraAPIPack", Installed = {}, Skipped = {}, NotImplemented = {}, _config = { installGameHttp = true, installDrawing = true, }, } -- Engine local HookEngine = { Version = "3.0-embedded", Registry = {}, } local _getrawmetatable = getrawmetatable local _setrawmetatable = setrawmetatable local _setreadonly = setreadonly local _isreadonly = isreadonly local _newcclosure = newcclosure local _iscclosure = iscclosure local _clonefunction = clonefunction local _checkcaller = checkcaller local _getnamecallmethod = getnamecallmethod local _warn = (type(warn) == "function") and warn or print local function getMT(target) if type(_getrawmetatable) == "function" then local ok, mt = pcall(_getrawmetatable, target) if ok and type(mt) == "table" then return mt end end local dmt = debug and debug.getmetatable if type(dmt) == "function" then local ok, mt = pcall(dmt, target) if ok then return (type(mt) == "table") and mt or nil end end local ok, mt = pcall(getmetatable, target) if ok then return (type(mt) == "table") and mt or nil end return nil end local METAMETHODS = { __index = true, __newindex = true, __namecall = true, __call = true, __tostring = true, __unm = true, __add = true, __sub = true, __mul = true, __div = true, __mod = true, __pow = true, __concat = true, __len = true, __eq = true, __lt = true, __le = true, } local SYNTHESIZABLE = { __namecall = true, __call = true, } local function safeIsReadonly(mt) if type(_isreadonly) == "function" then local ok, res = pcall(_isreadonly, mt) if ok then return res == true end end return nil end local function safeSetReadonly(mt, state) if type(_setreadonly) == "function" then return pcall(_setreadonly, mt, state) end return false, "setreadonly no disponible" end local function safeClone(fn) if type(_clonefunction) == "function" and type(fn) == "function" then local ok, cloned = pcall(_clonefunction, fn) if ok and type(cloned) == "function" then return cloned end end return fn end local function adaptClosure(hookFn, refFn) if type(_iscclosure) == "function" and type(_newcclosure) == "function" then local isC = false local okC, resC = pcall(_iscclosure, refFn) if okC then isC = (resC == true) end local hookIsC = false local okHC, resHC = pcall(_iscclosure, hookFn) if okHC then hookIsC = (resHC == true) end if isC and not hookIsC then local okW, wrapped = pcall(_newcclosure, hookFn) if okW and type(wrapped) == "function" then return wrapped end end end return hookFn end local function withUnlockedMT(mt, fn) local ok, result = pcall(fn, mt) if ok then return true, result end local wasRO = safeIsReadonly(mt) if type(_setreadonly) ~= "function" then return false, result end local unlocked = pcall(safeSetReadonly, mt, false) local ok2, result2 = pcall(fn, mt) if unlocked and (wasRO == true or wasRO == nil) then pcall(safeSetReadonly, mt, true) end if ok2 then return true, result2 end return false, result2 end local function getKey(mt, metamethod) return tostring(mt) .. "::" .. metamethod end local function buildContext(metamethod, firstArg) local method = nil if metamethod == "__namecall" and type(_getnamecallmethod) == "function" then local ok, m = pcall(_getnamecallmethod) if ok and type(m) == "string" then method = m end end local fromCaller = false if type(_checkcaller) == "function" then local ok, c = pcall(_checkcaller) if ok then fromCaller = (c == true) end end return { metamethod = metamethod, method = method, firstArg = firstArg, fromCaller = fromCaller, } end function HookEngine:Hook(target, metamethod, handler, options) if target == nil then error("SolaraHookMM: target cannot be nil", 2) end if type(metamethod) ~= "string" or not METAMETHODS[metamethod] then error("SolarAHookMM: invalid metamethod -> " .. tostring(metamethod), 2) end if type(handler) ~= "function" then error("SolaraHookMM: handler must be function", 2) end options = options or {} local mt = getMT(target) if type(mt) ~= "table" then error("SolaraHookMM: target without editable metatable", 2) end local currentMM = rawget(mt, metamethod) local synthesized = false if type(currentMM) ~= "function" then if SYNTHESIZABLE[metamethod] then currentMM = nil synthesized = true else error("SolaraHookMM: '" .. metamethod .. "' It is not a function (non-synthesizable slot)", 2) end end local key = getKey(mt, metamethod) local entry = self.Registry[key] if not entry then entry = { mt = mt, metamethod = metamethod, root = safeClone(currentMM), synthesized = synthesized, stack = {}, } self.Registry[key] = entry end local function shouldRun(ctx, itemOpts) if itemOpts.onlyGameCalls and ctx.fromCaller then return false end if itemOpts.onlyCallerCalls and not ctx.fromCaller then return false end local filter = itemOpts.methodFilter if filter then local m = ctx.method if m == nil and ctx.metamethod == "__index" then m = ctx.firstArg end if type(m) == "string" then if type(filter) == "string" then return m == filter elseif type(filter) == "table" then return filter[m] == true end end return false end return true end local function rebuild() local chainFn = entry.root for i = 1, #entry.stack do local item = entry.stack[i] if item.enabled then local nextFn = chainFn local userFn = item.handler local itemOpts = item.options local safeMode = (itemOpts.safe ~= false) chainFn = function(selfObj, ...) item.calls = item.calls + 1 local ctx = buildContext(entry.metamethod, ...) if shouldRun(ctx, itemOpts) then if safeMode then local okR, a, b, c, d, e, f = pcall(userFn, nextFn, ctx, selfObj, ...) if okR then return a, b, c, d, e, f end _warn("[SolaraAPIPack] handler failed, continue the chain: " .. tostring(a)) return nextFn(selfObj, ...) end return userFn(nextFn, ctx, selfObj, ...) end return nextFn(selfObj, ...) end end end chainFn = adaptClosure(chainFn, entry.root) local okWrite, errWrite = withUnlockedMT(entry.mt, function(m) rawset(m, entry.metamethod, chainFn) end) if not okWrite then _warn("[SolaraAPIPack] could not write the metamethod: " .. tostring(errWrite)) end end local node = { handler = handler, options = options, enabled = true, calls = 0, } table.insert(entry.stack, node) local okR, errR = pcall(rebuild) if not okR then _warn("[SolaraAPIPack] initial rebuild failed: " .. tostring(errR)) end local controller = { entry = entry, node = node, key = key, } function controller:SetEnabled(state) self.node.enabled = (state == true) local okR2, errR2 = pcall(rebuild) if not okR2 then _warn("[SolaraAPIPack] rebuild failed: " .. tostring(errR2)) end return okR2 end function controller:GetCalls() return self.node.calls end function controller:Unhook() for i, n in ipairs(self.entry.stack) do if n == self.node then table.remove(self.entry.stack, i) break end end if HookEngine.Registry[self.key] ~= self.entry then return false, "entry no longer registered" end if #self.entry.stack == 0 then local restore = self.entry.synthesized and nil or self.entry.root local okW, errW = withUnlockedMT(self.entry.mt, function(m) rawset(m, self.entry.metamethod, restore) end) HookEngine.Registry[self.key] = nil return okW, errW end local okR3, errR3 = pcall(rebuild) return okR3, errR3 end return entry.root, controller end function HookEngine:UnhookAll() for key, entry in pairs(self.Registry) do local restore = entry.synthesized and nil or entry.root withUnlockedMT(entry.mt, function(m) rawset(m, entry.metamethod, restore) end) self.Registry[key] = nil end end function HookEngine.WriteSlot(mt, metamethod, value) return withUnlockedMT(mt, function(m) rawset(m, metamethod, value) end) end -- Helpers local function genv() local ok, g = pcall(getgenv) if ok and type(g) == "table" then return g end return _G end local function hasGlobal(name) local g = genv() local v = nil if type(g) == "table" then v = rawget(g, name) end if v == nil then v = rawget(_G, name) end if v == nil and getfenv then local okF, f = pcall(getfenv, 1) if okF and type(f) == "table" then v = f[name] end end return v ~= nil, v end local function define(name, impl, note, force) local exists = hasGlobal(name) if exists and not force then Pack.Skipped[name] = "It already exists (it's not being touched)" return false end local g = genv() g[name] = impl rawset(_G, name, impl) if getfenv then pcall(function() local fenv = getfenv(1) if type(fenv) == "table" and fenv[name] == nil then fenv[name] = impl end end) end Pack.Installed[name] = note or "polyfill" return true end local function notImpl(name, reason) Pack.NotImplemented[name] = reason return false end Pack.UnhookAll = function() HookEngine:UnhookAll() end Pack.SolaraHookMM = HookEngine -- crypt: base64 + sha1 local B64CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" local function b64encode(data) data = tostring(data) local out = {} local i = 1 while i <= #data do local a, b, c = string.byte(data, i, i + 2) local pad = 0 if b == nil then b = 0 pad = pad + 1 end if c == nil then c = 0 pad = pad + 1 end local n = a * 65536 + b * 256 + c local s1 = math.floor(n / 262144) % 64 local s2 = math.floor(n / 4096) % 64 local s3 = math.floor(n / 64) % 64 local s4 = n % 64 local chunk = B64CHARS:sub(s1 + 1, s1 + 1) .. B64CHARS:sub(s2 + 1, s2 + 1) if pad == 0 then chunk = chunk .. B64CHARS:sub(s3 + 1, s3 + 1) .. B64CHARS:sub(s4 + 1, s4 + 1) elseif pad == 1 then chunk = chunk .. B64CHARS:sub(s3 + 1, s3 + 1) .. "=" else chunk = chunk .. "==" end out[#out + 1] = chunk i = i + 3 end return table.concat(out) end local B64REV = {} do for i = 1, #B64CHARS do B64REV[B64CHARS:sub(i, i)] = i - 1 end end local function b64decode(data) data = (tostring(data):gsub("[^%w%+/%=]", "")) local out = {} local i = 1 while i <= #data do local c1 = data:sub(i, i) local c2 = data:sub(i + 1, i + 1) local c3 = data:sub(i + 2, i + 2) local c4 = data:sub(i + 3, i + 3) local n = (B64REV[c1] or 0) * 262144 + (B64REV[c2] or 0) * 4096 + (B64REV[c3] or 0) * 64 + (B64REV[c4] or 0) out[#out + 1] = string.char(math.floor(n / 65536) % 256) if c3 ~= "" and c3 ~= "=" then out[#out + 1] = string.char(math.floor(n / 256) % 256) end if c4 ~= "" and c4 ~= "=" then out[#out + 1] = string.char(n % 256) end i = i + 4 end return table.concat(out) end -- 32-bit bit emulation local function band(a, b) local r, pow = 0, 1 for _ = 0, 31 do local ba, bb = a % 2, b % 2 if ba == 1 and bb == 1 then r = r + pow end a = (a - ba) / 2 b = (b - bb) / 2 pow = pow * 2 end return r end local function bor(a, b) local r, pow = 0, 1 for _ = 0, 31 do local ba, bb = a % 2, b % 2 if ba == 1 or bb == 1 then r = r + pow end a = (a - ba) / 2 b = (b - bb) / 2 pow = pow * 2 end return r end local function bxor(a, b) local r, pow = 0, 1 for _ = 0, 31 do local ba, bb = a % 2, b % 2 if ba ~= bb then r = r + pow end a = (a - ba) / 2 b = (b - bb) / 2 pow = pow * 2 end return r end local function bitnot(a) return 4294967295 - (a % 4294967296) end local function rol(x, n) x = x % 4294967296 return (x * (2 ^ n)) % 4294967296 + math.floor(x / (2 ^ (32 - n))) end local function sha1(message) local msg = { string.byte(tostring(message), 1, #message) } local ml = #msg msg[ml + 1] = 0x80 local padZeros = (55 - ml) % 64 for i = 1, padZeros do msg[ml + 1 + i] = 0 end local bitLen = ml * 8 local hi = math.floor(bitLen / 4294967296) local lo = bitLen % 4294967296 local base = ml + 1 + padZeros local lenBytes = { math.floor(hi / 16777216) % 256, math.floor(hi / 65536) % 256, math.floor(hi / 256) % 256, hi % 256, math.floor(lo / 16777216) % 256, math.floor(lo / 65536) % 256, math.floor(lo / 256) % 256, lo % 256, } for i = 1, 8 do msg[base + i] = lenBytes[i] end local h0, h1, h2, h3, h4 = 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 for off = 0, #msg - 1, 64 do local w = {} for i = 0, 15 do w[i] = msg[off + i * 4 + 1] * 16777216 + msg[off + i * 4 + 2] * 65536 + msg[off + i * 4 + 3] * 256 + msg[off + i * 4 + 4] end for i = 16, 79 do w[i] = rol(bxor(bxor(w[i - 3], w[i - 8]), bxor(w[i - 14], w[i - 16])), 1) end local a, b, c, d, e = h0, h1, h2, h3, h4 for i = 0, 79 do local f, k if i < 20 then f = bor(band(b, c), band(bitnot(b), d)) k = 0x5A827999 elseif i < 40 then f = bxor(bxor(b, c), d) k = 0x6ED9EBA1 elseif i < 60 then f = bor(bor(band(b, c), band(b, d)), band(c, d)) k = 0x8F1BBCDC else f = bxor(bxor(b, c), d) k = 0xCA62C1D6 end local temp = (rol(a, 5) + f + e + k + w[i]) % 4294967296 e = d d = c c = rol(b, 30) b = a a = temp end h0 = (h0 + a) % 4294967296 h1 = (h1 + b) % 4294967296 h2 = (h2 + c) % 4294967296 h3 = (h3 + d) % 4294967296 h4 = (h4 + e) % 4294967296 end return string.format("%08x%08x%08x%08x%08x", h0, h1, h2, h3, h4) end local cryptTable = { base64encode = b64encode, base64decode = b64decode, sha1 = sha1, base64 = { encode = b64encode, decode = b64decode }, } -- network: request / http_request (via HttpService) + game:HttpGet/HttpPost local function getHttpService() local ok, hs = pcall(function() return game:GetService("HttpService") end) if not ok or hs == nil then return nil, "HttpService not available (Is HttpEnabled disabled?)" end return hs end local function implRequest(params) if type(params) ~= "table" then error("request: a parameter table was expected", 2) end local url = params.Url or params.url if url == nil then error("request: missing URL", 2) end local hs, errHS = getHttpService() if not hs then error("request: " .. tostring(errHS), 2) end local method = tostring(params.Method or params.method or "GET"):upper() local ok, resp = pcall(hs.RequestAsync, hs, { Url = url, Method = method, Headers = params.Headers or params.headers, Body = params.Body or params.body or ((method ~= "GET") and "" or nil), }) if not ok then error("request: " .. tostring(resp), 2) end if type(resp) ~= "table" then error("request: invalid response from HttpService", 2) end return { Success = resp.Success == true, StatusCode = resp.StatusCode or resp.ResponseCode or 0, StatusMessage = resp.StatusMessage, Headers = resp.Headers or {}, Body = resp.Body or "", } end local function installGameHTTP() if not Pack._config.installGameHttp then return end local okG, gameRef = pcall(function() return game end) if not okG or gameRef == nil then notImpl("game:HttpGet", "there is no game instance in this environment") return end local alreadyGet = false pcall(function() alreadyGet = (gameRef.HttpGet ~= nil) end) local alreadyPost = false pcall(function() alreadyPost = (gameRef.HttpPost ~= nil) end) local hs, errHS = getHttpService() if not hs then notImpl("game:HttpGet", errHS) return end local httpGet = function(url, nocache) -- FIX 2.1.1: HttpGetAsync ya devuelve el body como string; antes "resp.Body" lanzaba error return hs:HttpGetAsync(tostring(url)) end local httpPost = function(url, data, contentType) return hs:PostAsync(tostring(url), tostring(data or ""), contentType) end if alreadyGet and alreadyPost then Pack.Skipped["game:HttpGet"] = "They already exist (they are not touched)" return end local okH, errH = pcall(function() HookEngine:Hook(gameRef, "__index", function(original, ctx, selfObj, key) local v = original(selfObj, key) if v == nil then if key == "HttpGet" and not alreadyGet then return httpGet end if key == "HttpPost" and not alreadyPost then return httpPost end end return v end, { safe = true }) end) if okH then if not alreadyGet then Pack.Installed["game:HttpGet"] = "via game hook __index + HttpService" end if not alreadyPost then Pack.Installed["game:HttpPost"] = "via game hook __index + HttpService" end else notImpl("game:HttpGet", "Could not hook __index of game: " .. tostring(errH)) end end -- instances / identification local function implGetHui() local cached = Pack._huiCache if cached ~= nil then local alive = false pcall(function() alive = (cached.Parent ~= nil) end) if alive then return cached end Pack._huiCache = nil end local okCG, cg = pcall(function() return game:GetService("CoreGui") end) if okCG and cg ~= nil then Pack._huiCache = cg return cg end local okPG, pg = pcall(function() return game:GetService("Players").LocalPlayer.PlayerGui end) if okPG and pg ~= nil then local okF, folder = pcall(function() local f = Instance.new("Folder") f.Name = "SolaraAPIPackUI" f.Parent = pg return f end) if okF and folder ~= nil then Pack._huiCache = folder return folder end end error("gethui: No safe container was found for the UI", 2) end local function implGetPlaceId() return game.PlaceId end local function implGetGameId() return game.PlaceId end local function implGetJobId() return game.JobId end -- Drawing local DRAWING_CLASSES = { Line = true, Text = true, Square = true, Circle = true, Image = true, Triangle = true, } local DRAWING_DEFAULTS = { Visible = true, Transparency = 0, Thickness = 1, ZIndex = 0, Text = "", Size = 0, Font = 0, Center = false, Outline = false, Filled = false, Radius = 0, NumSides = 30, } local function newDrawing(class) if not DRAWING_CLASSES[class] then error("Drawing.new: unsupported class -> " .. tostring(class) .. " (valid: Line, Text, Square, Circle, Image, Triangle)", 2) end local backing = {} for k, v in pairs(DRAWING_DEFAULTS) do backing[k] = v end local removed = false local methods = {} methods.Remove = function() removed = true end methods.Destroy = function() removed = true end local proxy = setmetatable({}, { __index = function(_, k) if removed then error("Drawing." .. class .. " was removed", 2) end if methods[k] ~= nil then return methods[k] end if k == "TextBounds" then return { X = 0, Y = 0 } end if k == "ClassName" then return class end return backing[k] end, __newindex = function(_, k, v) if removed then error("Drawing." .. class .. " was removed", 2) end if k == "TextBounds" or k == "ClassName" then error("Drawing." .. class .. ": '" .. tostring(k) .. "' It is read-only", 2) end backing[k] = v end, __tostring = function() return "Drawing." .. class end, }) return proxy end local DrawingLib = { Fonts = { Panda = 0, Mono = 1, Monospace = 2, Sans = 3, Bold = 4 }, new = newDrawing, Clear = function() _warn("[SolaraAPIPack] Drawing.Clear: the implementation does not render, nothing clears") end, } local NOT_IMPLEMENTED_REASONS = { hookfunction = "Partial only: Replacing arbitrary closures requires the engine; use hookmetamethod", getgc = "Enumerating the GC requires C support from the executor", getreg = "Lua registry is not accessible from the sandbox", getloadedmodules = "Requires C support", getcallingscript = "Requires C support", getscriptclosure = "Requires C support", getconstants = "Requires the executor's bytecode inspector", getconstant = "Requires the executor's bytecode inspector", setconstant = "Requires the executor's bytecode inspector", getprotos = "Requires the executor's bytecode inspector", getproto = "Requires the executor's bytecode inspector", getconnections = "Requires C support", fireclickdetector = "Requires C support", firetouchinterest = "Requires C support", fireproximityprompt = "Requires C support", firesignal = "Requires C support", getnilinstances = "Requires support C", setclipboard = "requires C support (system clipboard)", queue_on_teleport = "requires the executor's internal queue to survive teleports", websocket = "requires network C support", getcustomasset = "requires C support", setfpscap = "requires C support", readfile = "filesystem requires the executor engine (Solara includes it natively)", writefile = "filesystem requires the executor engine (Solara includes it natively)", listfiles = "filesystem requires the executor engine (Solara includes it natively)", isfile = "filesystem requires the executor engine (Solara includes it natively)", Drawing = "full interface BUT no on-screen rendering (requires engine)", newcclosure = "fallback identity: no real C-closure", iscclosure = "approximate: does not distinguish Lua C-closures", } -- installation function Pack.Install() -- core / environment define("getgenv", function() return _G end, "fallback: shared environment = _G") define("identifyexecutor", function() return "Solara", Pack.Version end, "fixed fallback") define("getexecutorname", function() return "Solara", Pack.Version end, "alias of identifyexecutor") define("typeof", function(v) return type(v) end, "basic type fallback") -- hooks define("hookmetamethod", function(object, metamethod, newFn) if type(newFn) ~= "function" then error("hookmetamethod: the replacement must be functional", 2) end local okMT, mt = pcall(getrawmetatable, object) if okMT and type(mt) == "table" and type(setreadonly) == "function" and mt[metamethod] ~= nil then local old = mt[metamethod] local wasRO = false pcall(function() wasRO = (type(isreadonly) == "function") and isreadonly(mt) or false end) local hooked = newFn if type(newcclosure) == "function" then local okCC, cc = pcall(newcclosure, newFn) if okCC and type(cc) == "function" then hooked = cc end end local okU = pcall(setreadonly, mt, false) if not okU and type(make_writable) == "function" then pcall(make_writable, mt) okU = pcall(setreadonly, mt, false) end if not okU then local original, controller = HookEngine:Hook(object, metamethod, function(originalFn, ctx, selfObj, ...) return newFn(selfObj, ...) end) return original, controller end local okSet = pcall(function() mt[metamethod] = hooked end) if not okSet then local original, controller = HookEngine:Hook(object, metamethod, function(originalFn, ctx, selfObj, ...) return newFn(selfObj, ...) end) return original, controller end pcall(setreadonly, mt, wasRO) return old, { Unhook = function() pcall(setreadonly, mt, false) mt[metamethod] = old pcall(setreadonly, mt, wasRO) end, } end local original, controller = HookEngine:Hook(object, metamethod, function(originalFn, ctx, selfObj, ...) return newFn(selfObj, ...) end) return original, controller end, "real path (getrawmetatable+setreadonly+newcclosure) fallback engine ") define("hookfunction", function(original, replacement) if type(original) ~= "function" or type(replacement) ~= "function" then error("hookfunction: two functions were expected", 2) end error("hookfunction: arbitrary replacement of closures required by the engine; use hookmetamethod " .. "(hookmetamethod(target, mm, fn) Yes, it is available in this pack)", 2) end, "indicative (clear error; the real one requires engine)") define("newcclosure", function(f) if type(f) ~= "function" then error("newcclosure: a feature was expected", 2) end return f end, "identity fallback") define("isfunction", function(v) return type(v) == "function" end, "real") define("iscclosure", function(v) return type(v) == "function" end, "approximate") -- metatables / readonly define("getrawmetatable", function(target) return getMT(target) end, "fallback debug.getmetatable") define("setrawmetatable", function(target, mt) return pcall(setmetatable, target, mt) end, "fallback setmetatable (tables only)") define("setreadonly", function() return true end, "no-op (without native setreadonly)") define("isreadonly", function() return false end, "approximate (unknown state)") -- upvalues local dbg = debug if dbg and type(dbg.getupvalue) == "function" then define("getupvalue", dbg.getupvalue, "vía debug.getupvalue") define("setupvalue", dbg.setupvalue, "vía debug.setupvalue") define("getupvalues", function(f) local t = {} for i = 1, 200 do local n, v = dbg.getupvalue(f, i) if n == nil then break end t[i] = v end return t end, "vía debug.getupvalue (bucle)") define("setupvalues", function(f, t) for i, v in pairs(t) do dbg.setupvalue(f, i, v) end end, "vía debug.setupvalue (bucle)") else notImpl("getupvalue", "debug.getupvalue does not exist in this environment") end -- crypt Pack.CryptImpl = { sha1 = cryptTable.sha1, base64 = cryptTable.base64encode } define("crypt", cryptTable, "base64 + sha1") define("base64", cryptTable.base64, "alias of crypt.base64") -- red define("request", implRequest, "vía HttpService:RequestAsync") define("http_request", implRequest, "alias de request") installGameHTTP() -- instances / ids define("gethui", implGetHui, "CoreGui or hidden folder in PlayerGui") define("getplaceid", implGetPlaceId, "vía game.PlaceId") define("getgameid", implGetGameId, "vía game.PlaceId") define("getjobid", implGetJobId, "vía game.JobId") -- Drawing if Pack._config.installDrawing then define("Drawing", DrawingLib, "Full interface (does NOT render)") end for name, reason in pairs(NOT_IMPLEMENTED_REASONS) do if Pack.NotImplemented[name] == nil then Pack.NotImplemented[name] = reason end end Pack._installed = true return Pack end function Pack.Report() local nI, nS, nN = 0, 0, 0 for _ in pairs(Pack.Installed) do nI = nI + 1 end for _ in pairs(Pack.Skipped) do nS = nS + 1 end for _ in pairs(Pack.NotImplemented) do nN = nN + 1 end print(("═══ %s v%s ═══"):format(Pack.Name, Pack.Version)) print((" Installed : %d"):format(nI)) print((" Omitted: %d (already existed in the executor, they are not touched)"):format(nS)) print((" Not possible: %d (exigen engine; detalles en Pack.NotImplemented)"):format(nN)) return nI, nS, nN end -- Automatic installation upon running the pack (paste and you're done) Pack.Install() do local nI, nS, nN = 0, 0, 0 for _ in pairs(Pack.Installed) do nI = nI + 1 end for _ in pairs(Pack.Skipped) do nS = nS + 1 end for _ in pairs(Pack.NotImplemented) do nN = nN + 1 end print(("[SolaraAPIPack v%s] %d Installed APIs · %d already existed (intact) · %d not possible in pure Lua (details in Pack.NotImplemented)"):format( Pack.Version, nI, nS, nN)) end -- Solara canonical list (top-level names; sub-tables cover the entire table: crypt, Drawing, WebSocket, Input) -- table Pack.SolaraDoc = { getgenv = 1, getreg = 1, getrenv = 1, checkcaller = 1, require = 1, newcclosure = 1, clonefunction = 1, newlclosure = 1, iscclosure = 1, islclosure = 1, loadstring = 1, getrawmetatable = 1, getnamecallmethod = 1, setreadonly = 1, isreadonly = 1, getthreadidentity = 1, setthreadidentity = 1, isscriptable = 1, setscriptable = 1, gethiddenproperty = 1, sethiddenproperty = 1, isnetworkowner = 1, cloneref = 1, compareinstances = 1, gethui = 1, getinstances = 1, getnilinstances = 1, getscripts = 1, getrunningscripts = 1, getloadedmodules = 1, getscriptclosure = 1, getscriptbytecode = 1, getscripthash = 1, decompile = 1, saveinstance = 1, lrm_load_script = 1, request = 1, gethwid = 1, identifyexecutor = 1, messagebox = 1, setclipboard = 1, setfpscap = 1, getfpscap = 1, setsimulationradius = 1, setfflag = 1, getfflag = 1, fireclickdetector = 1, fireproximityprompt = 1, firetouchinterest = 1, queue_on_teleport = 1, clearqueueonteleport = 1, isfile = 1, readfile = 1, isfolder = 1, writefile = 1, appendfile = 1, delfolder = 1, delfile = 1, makefolder = 1, listfiles = 1, getcustomasset = 1, loadfile = 1, dofile = 1, base64encode = 1, base64decode = 1, lz4compress = 1, lz4decompress = 1, zstdcompress = 1, zstddecompress = 1, crypt = 1, WebSocket = 1, keypress = 1, keyrelease = 1, keyclick = 1, mouse1click = 1, mouse1press = 1, mouse1release = 1, mouse2click = 1, mouse2press = 1, mouse2release = 1, mousescroll = 1, mousemoverel = 1, mousemoveabs = 1, isrbxactive = 1, Input = 1, Drawing = 1, rconsolecreate = 1, rconsoledestroy = 1, rconsoleprint = 1, rconsoleinfo = 1, rconsolewarn = 1, rconsoleerr = 1, rconsoleclear = 1, rconsolesettitle = 1, rconsoleinput = 1, printconsole = 1, hookmetamethod = 1, hookfunction = 1, } local vxExtras = {} -- [name] = note of how it was installed local function vxHasGlobal(name) local okG, g = pcall(getgenv) if okG and type(g) == "table" and rawget(g, name) ~= nil then return true end local okR, r = pcall(rawget, _G, name) if okR and r ~= nil then return true end if getfenv then local okF, f = pcall(getfenv, 1) if okF and type(f) == "table" and f[name] ~= nil then return true end end return false end local function vxDefine(name, impl, note) if vxHasGlobal(name) then vxExtras[name] = "It already existed in the executor (intact)" return false end rawset(_G, name, impl) local okG, g = pcall(getgenv) if okG and type(g) == "table" then rawset(g, name, impl) end vxExtras[name] = note or "polyfill" return true end local vxScanCache = nil local function vxScanAll() local now = os.clock() if vxScanCache and (now - vxScanCache.t) < 1.0 then return vxScanCache.r end local nils, hidden, scripts, modules = {}, {}, {}, {} local ok, objs = pcall(function() return getgc(true) end) if ok and type(objs) == "table" then local tOf = typeof for _, v in ipairs(objs) do local isInst = false if tOf then local okT, t = pcall(tOf, v) isInst = okT and t == "Instance" end if isInst then local okC, cls = pcall(function() return v.ClassName end) if okC and type(cls) == "string" then local okP, par = pcall(function() return v.Parent end) if okP and par == nil then nils[#nils + 1] = v else local cur, hops = par, 0 while cur and cur ~= game and hops < 40 do local okP2, p2 = pcall(function() return cur.Parent end) cur = okP2 and p2 or nil hops = hops + 1 end if cur ~= game then hidden[#hidden + 1] = v end end if cls == "ModuleScript" then modules[#modules + 1] = v end if cls == "LocalScript" or cls == "ModuleScript" or cls == "Script" then scripts[#scripts + 1] = v end end end end end local r = { nils = nils, hidden = hidden, scripts = scripts, modules = modules, ok = ok } vxScanCache = { t = now, r = r } return r end local function vxCopyList(list, cap) local out = {} for i = 1, math.min(#list, cap or 100000) do out[i] = list[i] end return out end if type(getgc) == "function" then vxDefine("getinstances", function() local r = vxScanAll() local out, n = {}, 0 pcall(function() for _, d in ipairs(game:GetDescendants()) do n = n + 1 out[n] = d end end) for _, v in ipairs(r.nils) do n = n + 1 out[n] = v end for _, v in ipairs(r.hidden) do n = n + 1 out[n] = v end for _, v in ipairs(r.scripts) do n = n + 1 out[n] = v end for _, v in ipairs(r.modules) do n = n + 1 out[n] = v end return out end, "custom: DataModel + getgc(true) sweep (cache 1 s)") vxDefine("getnilinstances", function() local r = vxScanAll() return vxCopyList(r.nils) end, "custom: getgc(true) sweep, instances with Parent = nil") vxDefine("gethiddeninstances", function() local r = vxScanAll() return vxCopyList(r.hidden) end, "custom: getgc(true) + roots that do not reach the DataModel") vxDefine("getscripts", function() local r = vxScanAll() return vxCopyList(r.scripts) end, "custom: getgc(true) filtering Script/LocalScript/ModuleScript") vxDefine("getloadedmodules", function() local r = vxScanAll() return vxCopyList(r.modules) end, "custom: getgc(true) filtering ModuleScript") else vxExtras["getgc"] = "NOT AVAILABLE: Requires native executor support" end local vxB64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" local function vxB64(data) local out = {} local i = 1 while i <= #data do local a, b, c = string.byte(data, i, math.min(i + 2, #data)) local n = (a or 0) * 65536 + (b or 0) * 256 + (c or 0) out[#out + 1] = vxB64Chars:sub(math.floor(n / 262144) % 64 + 1, math.floor(n / 262144) % 64 + 1) out[#out + 1] = vxB64Chars:sub(math.floor(n / 4096) % 64 + 1, math.floor(n / 4096) % 64 + 1) out[#out + 1] = b and vxB64Chars:sub(math.floor(n / 64) % 64 + 1, math.floor(n / 64) % 64 + 1) or "=" out[#out + 1] = c and vxB64Chars:sub(n % 64 + 1, n % 64 + 1) or "=" i = i + 3 end return table.concat(out) end local function vxB64Decode(data) data = data:gsub("[^" .. vxB64Chars .. "=]", "") local out = {} local i = 1 while i <= #data do local chunk = data:sub(i, i + 3) local n = 0 for j = 1, 4 do local ch = chunk:sub(j, j) n = n * 64 + (ch ~= "=" and (vxB64Chars:find(ch, 1, true) - 1) or 0) end out[#out + 1] = string.char(math.floor(n / 65536) % 256, math.floor(n / 256) % 256, n % 256) i = i + 4 end local joined = table.concat(out) local ln = #joined while ln > 0 and string.byte(joined, ln) == 0 do ln = ln - 1 end return string.sub(joined, 1, ln) end -- sha256 compacted local function vxSha256(data) 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 H = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 } local band, bor, bxor = bit32 and bit32.band or bit.band, bit32 and bit32.bor or bit.bor, bit32 and bit32.bxor or bit.bxor local lshift, rshift = bit32 and bit32.lshift or bit.lshift or bor, bit32 and bit32.rshift or bit.rshift local rrotate = bit32 and bit32.rrotate or function(x, n) return bor(rshift(x, n), lshift(x, 32 - n)) end local function tobits(x) return x end local msg = { string.byte(data, 1, -1) } local len = #msg msg[#msg + 1] = 0x80 while #msg % 64 ~= 56 do msg[#msg + 1] = 0 end local bl = len * 8 for i = 7, 0, -1 do msg[#msg + 1] = math.floor(bl / 2 ^ (i * 8)) % 256 end for block = 0, #msg / 64 - 1 do local w = {} for i = 0, 15 do local j = block * 64 + i * 4 + 1 w[i] = msg[j] * 16777216 + msg[j + 1] * 65536 + msg[j + 2] * 256 + msg[j + 3] end for i = 16, 63 do local s0 = bxor(rrotate(w[i - 15], 7), bxor(rrotate(w[i - 15], 18), rshift(w[i - 15], 3))) local s1 = bxor(rrotate(w[i - 2], 17), bxor(rrotate(w[i - 2], 19), rshift(w[i - 2], 10))) w[i] = (w[i - 16] + s0 + w[i - 7] + s1) % 4294967296 end local a, b, c, d, e, f, g, h = H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8] for i = 0, 63 do local S1 = bxor(rrotate(e, 6), bxor(rrotate(e, 11), rrotate(e, 25))) local ch = bxor(band(e, f), band(bxor(e, 4294967295), g)) local t1 = (h + S1 + ch + K[i + 1] + w[i]) % 4294967296 local S0 = bxor(rrotate(a, 2), bxor(rrotate(a, 13), rrotate(a, 22))) local maj = bxor(band(a, b), bxor(band(a, c), band(b, c))) local t2 = (S0 + maj) % 4294967296 h, g, f, e, d, c, b, a = g, f, e, (d + t1) % 4294967296, c, b, a, (t1 + t2) % 4294967296 end H[1] = (H[1] + a) % 4294967296 H[2] = (H[2] + b) % 4294967296 H[3] = (H[3] + c) % 4294967296 H[4] = (H[4] + d) % 4294967296 H[5] = (H[5] + e) % 4294967296 H[6] = (H[6] + f) % 4294967296 H[7] = (H[7] + g) % 4294967296 H[8] = (H[8] + h) % 4294967296 end local hex = {} for i = 1, 8 do hex[i] = ("%08x"):format(H[i]) end return table.concat(hex) end local function vxHashFn(data, algo) algo = (tostring(algo or "sha256")):lower() if algo == "sha256" or algo == "sha2" or algo == "sha-256" then return vxSha256(tostring(data)) elseif algo == "sha1" or algo == "sha-1" then if Pack.CryptImpl and Pack.CryptImpl.sha1 then return Pack.CryptImpl.sha1(tostring(data)) end return vxSha256(tostring(data)) end error("crypt.hash: algorithm not supported in polyfill: " .. tostring(algo)) end if not (type(crypt) == "table" and type(crypt.hash) == "function") then vxDefine("crypt", { hash = vxHashFn, hmac = function(data, key, algo) return vxB64(vxHashFn(tostring(key) .. tostring(data), algo)) end, base64 = { encode = vxB64, decode = vxB64Decode }, }, "custom: crypt.hash sha256/sha1 + base64 (fallback)") end if vxHasGlobal("crypt") and type(crypt) == "table" and not crypt.hash then crypt.hash = vxHashFn vxExtras["crypt.hash"] = "added to the native crypt table" end do local okE, encR = false, nil if vxHasGlobal("base64encode") then okE, encR = pcall(base64encode, "hello world") end if not (okE and encR == "aGVsbG8gd29ybGQ=") then rawset(_G, "base64encode", function(d) return vxB64(tostring(d)) end) vxExtras["base64encode"] = "custom: base64 encode" local okG, g = pcall(getgenv) if okG and type(g) == "table" then rawset(g, "base64encode", _G.base64encode) end end local okD, decR = false, nil if vxHasGlobal("base64decode") then okD, decR = pcall(base64decode, "aGVsbG8gd29ybGQ=") end if not (okD and decR == "hello world") then rawset(_G, "base64decode", vxB64Decode) vxExtras["base64decode"] = "custom: base64 decode with correct padding" local okG, g = pcall(getgenv) if okG and type(g) == "table" then rawset(g, "base64decode", vxB64Decode) end end end Pack.CryptImpl = { sha1 = Pack.CryptImpl and Pack.CryptImpl.sha1 or nil, sha256 = vxSha256, base64 = vxB64 } vxDefine("identifyexecutor", function() return "Solara (VX)", Pack.Version end, "custom: fixed name + pack version") vxDefine("getexecutorname", function() return "Solara (VX)", Pack.Version end, "custom: identify executor alias") if not hasGlobal("getfunctionhash") then local bxor = bit32 and bit32.bxor local function vxFnHash(fn) if type(fn) ~= "function" then error("getfunctionhash: a function was expected", 2) end local src, ln, nups = "?", 0, 0 pcall(function() local a = debug.info(fn, "s") if type(a) == "string" then src = a end end) pcall(function() local a, b = debug.info(fn, "l") ln = tonumber(a) or tonumber(b) or 0 end) pcall(function() local a, b, c = debug.info(fn, "u") nups = tonumber(a) or tonumber(b) or tonumber(c) or 0 end) local fp = tostring(src) .. "|" .. tostring(ln) .. "|" .. tostring(nups) local h = 2166136261 for i = 1, #fp do local b = string.byte(fp, i) h = bxor and bxor(h, b) or h h = (h * 16777619) % 4294967296 end return ("%08x%08x"):format(h, ln % 4294967296) end define("getfunctionhash", vxFnHash, "Approximate: lineage (source+line+upvalues) via debug.info — groups duplicates, not exact bytecode") end do -- FIX 2.1.1: merge-protect. Antes esto pisaba la VXCustomAPI propia del DEX -- (se perdia Native/Custom/Missing/VXAPIReport y el NilSpy leia campos que ya no existian). local _api = rawget(_G, "VXCustomAPI") if type(_api) ~= "table" then _api = {} end _api.Pack = Pack.Installed or {} _api.Extras = vxExtras _api.Doc = Pack.SolaraDoc _api.StatusOf = function(name) local exists = false local okV, v = pcall(function() return rawget(_G, name) end) exists = okV and v ~= nil if not exists then local okG, g = pcall(getgenv) if okG and type(g) == "table" then local okV2, v2 = pcall(function() return rawget(g, name) end) exists = okV2 and v2 ~= nil end end if not exists and getfenv then local okF, f = pcall(getfenv, 1) if okF and type(f) == "table" then local okV3, v3 = pcall(function() return f[name] end) exists = okV3 and v3 ~= nil end end -- FIX 2.1.1: si el DEX expone su tabla env como VXCustomAPI.Env, tambien se consulta if not exists and type(_api.Env) == "table" then local okE2, v4 = pcall(function() return rawget(_api.Env, name) end) exists = okE2 and v4 ~= nil end if exists and ((Pack.Installed and Pack.Installed[name] ~= nil) or vxExtras[name] ~= nil) then return "custom" end if exists then return "native" end if Pack.SolaraDoc and Pack.SolaraDoc[name] then return "doc" end return "missing" end rawset(_G, "VXCustomAPI", _api) end Pack.VXExtras = vxExtras rawset(_G, "SolaraAPIPack", Pack) -- handle global: el DEX puede consultar el pack return Pack