-- settings
local getfenvhook = true
local concathook = true
local loadshook = true
local printf = false -- not recommended, may spam your console
-- old raw
local old_rawset = rawset
local old_rawget = rawget
-- functions for lua 53+ and for deobf
if not loadstring then
function loadstring(code)
return load(code)
end
end
function getfenv(level)
level = (level or 1) + 1
local info = debug.getinfo(level, "f")
if not info then return _ENV end
local func = info.func
if type(func) ~= "function" then return _ENV end
local i = 1
while true do
local name, value = debug.getupvalue(func, i)
if not name then break end
if name == "_ENV" then
return value
end
i = i + 1
end
return _ENV
end
function unpack(arg)
return table.unpack(arg)
end
function typeof(value)
if type(value) == "string" then
return "string"
end
return
end
local function readable(str)
if type(str) ~= "string" or #str < 2 or str:find("[\0-\8\11\12\14-\31]") then return false end
local readable = 0
for i = 1, #str do
local c = str:byte(i)
if (c >= 32 and c <= 126) or c == 10 then readable = readable + 1 end
end
return (readable / #str) >= 0.8 and str:find("%a")
end
local function report(s)
if type(s) == "string" then
if not old_rawget(traced, s) then
old_rawset(traced, s, true)
local escaped_s = s:gsub("[\0-\8\10\11\12\14-\31]", function(char)
if char == "\b" then return "\\b" end
if char == "\n" then return "\\n" end
if char == "\t" then return "\\t" end
if char:byte(1) == 0 then return "\\0" end
return string.format("\\x%02x", char:byte(1))
end)
print(escaped_s, '\n')
end
end
end
local function exec(v)
if type(v) ~= "string" then return false end
if #v > 300 and (v:find("local") or v:find("function") or v:find("repeat") or v:find("while") or v:find("load") or v:find("getfenv") or v:find("string.char")) then
return true
end
if #v > 1000 and not readable(v) and #v > 0 then
return true
end
if #v > 50 and #v < 300 and (v:find("if") and v:find("then") and v:find("end")) then
return true
end
if v:find("_ENV") or v:find("setmetatable") or v:find("debug%.") then
return true
end
local hex = select(2, v:gsub("\\x", ""))
if hex > 10 then
return true
end
return false
end
spawn = spawn or function(fn) local co = coroutine.create(function() pcall(fn) end) coroutine.resume(co) end
task = task or {}
task.spawn = task.spawn or spawn
task.wait = function() return 0 end
wait = function() return 0 end
if printf then
function error(f)
print(f)
end
function warn(f)
print(f)
end
end
-- hook
local old_fenv = getfenv
local old_concat = table.concat
local old_char = string.char
local old_print = print
if getfenvhook then
local seen = {}
local function safe(v)
local t = typeof(v)
if t == "string" then
return string.format("%q", v)
elseif t == "Instance" then
return v:GetFullName()
else
return tostring(v)
end
end
getfenv = function(level)
local env = old_fenv(level)
return setmetatable({}, {
__index = function(_, key)
if type(key) == "string" and not seen[key] then
seen[key] = true
end
local val = env[key]
if type(val) == "function" then
return function(...)
local args = {...}
local out = {}
for i = 1, #args do
out[i] = safe(args[i])
end
print(tostring(
key .. "(" .. table.concat(out, ", ") .. ")", "\n"
))
return val(...)
end
end
return val
end
})
end
end
if concathook then
table.concat = function(tbl, sep, i, j)
sep = sep or ""
i = i or 1
j = j or #tbl
local result = old_concat(tbl, sep, i, j)
if readable(result) then
print(tostring(result))
end
if exec(result) then
print("concat hook v2\n", tostring(result))
end
return result
end
end
if loadshook then
loadstring = function(...)
print(tostring(...))
end
end
-- paste the script and run the code
-- ex script 'print("Hello World")'
local _ENV = getfenv()
local k=95
local function d(t)
local s='' for i=1,#t do s=s..string.char(bit32.bxor(t[i],k)) end return s end
local function SWhKOIwouE() return d({23,58,51,51,48,127,8,48,45,51,59}) end
print(SWhKOIwouE())