print("--//Made with Zfuscator\\--")
-- Define the Obfuscator Function
function obfuscate(script)
-- Helper Functions
local function generateRandomName()
return "v" .. math.random(100000, 999999)
end
local function encryptString(str)
return (str:gsub(".", function(c)
return string.format("\\x%02X", string.byte(c))
end))
end
local function decryptString(str)
return (str:gsub("\\x(%x%x)", function(hex)
return string.char(tonumber(hex, 16))
end))
end
-- Variable Renaming
local renamed = {}
local counter = 0
script = script:gsub("%f[%a_](%w+)%f[^%w_]", function(var)
if not renamed[var] then
counter = counter + 1
renamed[var] = generateRandomName()
end
return renamed[var]
end)
-- String Encryption
script = script:gsub('"(.-)"', function(str)
return '"..decryptString("' .. encryptString(str) .. '").."'
end)
-- Add Decryption Function to the Script
script = [[
local function decryptString(str)
return (str:gsub("\\x(%x%x)", function(hex)
return string.char(tonumber(hex, 16))
end))
end
]] .. script
-- Control Flow Obfuscation
script = "local function _a() return true end; local function _b() if _a() then " ..
"while not false do if true then " ..
script ..
" end end end end; _b()"
-- Whitespace Removal & Code Flattening
script = script:gsub("%s+", "") -- Remove whitespace and newlines
script = script:gsub("\n", "") -- Remove newlines
script = script:gsub("endend", "end") -- Flatten end statements
-- Dead Code Insertion
script = "local dummy = function() return true end; local junk = function() " ..
"for i=1,100 do if i % 2 == 0 then end end end; junk(); dummy(); " .. script
return script
end
-- Your Lua script to be obfuscated
local myScript = [[
Script Here!
]]
-- Obfuscate the Script
local obfuscatedScript = obfuscate(myScript)
-- Print the Obfuscated Script
print(obfuscatedScript)
To embed this project on your website, copy the following code and paste it into your website's HTML: