-- 小玖儿 表情包加密+超强防反编译 -- 作者:小玖儿 QQ:340900689 gg.setVisible(false) math.randomseed(os.time()) -- 文件读写 local function readFile(path) local f = io.open(path, "r") if not f then return nil end local data = f:read("*a") f:close() return data end local function writeFile(path, data) local f = io.open(path, "wb") if not f then return false end f:write(data) f:close() return true end -- 简易字符偏移加密 local function encodeChar(byte) return byte + 59 end local function decodeChar(byte) return byte - 59 end -- 单层稳固代码封装混淆 local function wrapScript(code) local wrapStr = "local env=_G local run=function() "..code.." end run()" local func = load(wrapStr) if not func then return nil end -- 清除调试信息,防反编译 return string.dump(func, true) end -- 双重加固封装提升强度 local function doubleProtect(byteData) local outer = "local buf=... local exe=load(buf) if exe then exe() end" local outerFunc = load(outer) if not outerFunc then return byteData end return string.dump(outerFunc, true) end -- 主加密流程 local function encryptMain(source) local firstWrap = wrapScript(source) if not firstWrap then return nil end local finalByte = doubleProtect(firstWrap) return finalByte end -- 程序入口 local function Main() local selectFile = gg.prompt({"选择要加密的脚本"},{"/storage/emulated/0/"},{"file"}) if not selectFile or not selectFile[1] then return end local originCode = readFile(selectFile[1]) if not originCode then gg.alert("读取文件失败") return end local encryptByte = encryptMain(originCode) if not encryptByte then gg.alert("加密失败,脚本语法异常") return end local savePath = selectFile[1]:gsub("%.lua","_表情超强加密.lua") if writeFile(savePath,encryptByte) then gg.alert("加密完成\n双层混淆加固防护") else gg.alert("文件写入失败") end end Main()