├── .gitignore ├── Obfuscator.lua └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Lua sources 2 | luac.out 3 | 4 | # luarocks build files 5 | *.src.rock 6 | *.zip 7 | *.tar.gz 8 | 9 | # Object files 10 | *.o 11 | *.os 12 | *.ko 13 | *.obj 14 | *.elf 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Libraries 21 | *.lib 22 | *.a 23 | *.la 24 | *.lo 25 | *.def 26 | *.exp 27 | 28 | # Shared objects (inc. Windows DLLs) 29 | *.dll 30 | *.so 31 | *.so.* 32 | *.dylib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | *.i*86 39 | *.x86_64 40 | *.hex 41 | 42 | -------------------------------------------------------------------------------- /Obfuscator.lua: -------------------------------------------------------------------------------- 1 | local value = 1 2 | local function randomString(length) 3 | local random = "" 4 | local characters = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"} 5 | for i=1, length do 6 | random = random..characters[math.random(1, #characters)] 7 | end 8 | return random 9 | end 10 | local function obfuscateScript(string) 11 | value = value + 1 12 | math.randomseed(os.time() + value) 13 | --//* Lua 5.1 Functions 14 | local printRandom = randomString(10) 15 | local gRandom = randomString(10) 16 | local versionRandom = randomString(10) 17 | local assertRandom = randomString(10) 18 | local collectgarbageRandom = randomString(10) 19 | local dofileRandom = randomString(10) 20 | local errorRandom = randomString(10) 21 | local getfenvRandom = randomString(10) 22 | local getmtRandom = randomString(10) 23 | local ipairsRandom = randomString(10) 24 | local loadRandom = randomString(10) 25 | local loadfRandom = randomString(10) 26 | local loadstringRandom = randomString(10) 27 | local moduleRandom = randomString(10) 28 | local nextRandom = randomString(10) 29 | local pairsRandom = randomString(10) 30 | local pcallRandom = randomString(10) 31 | local setmtRandom = randomString(10) 32 | --//* Functions End 33 | --//* New Variables 34 | local newPrint = "local "..printRandom.." = print\n" 35 | local newGRandom = "local "..gRandom.." = _G\n" 36 | local newVersionRandom = "local "..versionRandom.." = _VERSION\n" 37 | local newAssert = "local "..assertRandom.." = assert\n" 38 | local newCollectGarbage = "local "..collectgarbageRandom.." = collectgarbage\n" 39 | local newDoFile = "local "..dofileRandom.." = dofile\n" 40 | local newError = "local "..errorRandom.." = error\n" 41 | local newGetFenv = "local "..getfenvRandom.." = getfenv\n" 42 | local newGetMt = "local "..getmtRandom.." = getmetatable\n" 43 | local newIPairs = "local "..ipairsRandom.." = ipairs\n" 44 | local newLoad = "local "..loadRandom.." = load\n" 45 | local newLoadF = "local "..loadfRandom.." = loadfile\n" 46 | local newLoadS = "local "..loadstringRandom.." = loadstring\n" 47 | local newModule = "local "..moduleRandom.." = module\n" 48 | local newNext = "local "..nextRandom.." = next\n" 49 | local newPairs = "local "..pairsRandom.." = pairs\n" 50 | local newPcall = "local "..pcallRandom.." = pcall\n" 51 | local newSetMt = "local "..setmtRandom.." = setmetatable\n" 52 | --//* New Variables End 53 | --//* Pattern Search 54 | string = string.gsub(string, "print", printRandom) 55 | string = string.gsub(string, "_G", gRandom) 56 | string = string.gsub(string, "_VERSION", versionRandom) 57 | string = string.gsub(string, "assert", assertRandom) 58 | string = string.gsub(string, "collectgarbage", collectgarbageRandom) 59 | string = string.gsub(string, "dofile", dofileRandom) 60 | string = string.gsub(string, "error", errorRandom) 61 | string = string.gsub(string, "getfenv", getfenvRandom) 62 | string = string.gsub(string, "getmetatable", getmtRandom) 63 | string = string.gsub(string, "ipairs", ipairsRandom) 64 | string = string.gsub(string, "load", loadRandom) 65 | string = string.gsub(string, "loadfile", loadfRandom) 66 | string = string.gsub(string, "loadstring", loadstringRandom) 67 | string = string.gsub(string, "module", moduleRandom) 68 | string = string.gsub(string, "next", nextRandom) 69 | string = string.gsub(string, "pairs", pairsRandom) 70 | string = string.gsub(string, "pcall", pcallRandom) 71 | string = string.gsub(string, "setmetatable", setmtRandom) 72 | --//* Pattern Search End 73 | --//* Print Obfuscated Script 74 | print(newSetMt..newGetMt..newIPairs..newLoad..newLoadF..newLoadS..newModule..newNext..newPairs..newPcall..newPrint..newGRandom..newVersionRandom..newAssert..newCollectGarbage..newDoFile..newError..newGetFenv..string) 75 | --//* Print Obfuscated Script End 76 | end 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LuaObfuscator 2 | This is a Lua Obfuscator which currently is being worked on by Peep/Me. 3 | 4 | ## What does this do? 5 | This goes through your script and searches for different things it can change. So if you have "print" for example in your script it will be replaced with a random string, that updates every execute. 6 | 7 | ## How do I use this? 8 | To use this. get the script, and call the function "obfuscateScript" with the first argument being your script, heres an example. 9 | ```lua 10 | obfuscateScript([[ 11 | print("Hi") 12 | ]]) 13 | ``` 14 | 15 | ## What does this currently obfuscate/change? 16 | If found, it will change: 17 | print 18 | _G 19 | _VERSION 20 | assert 21 | collectgarbage 22 | dofile 23 | error 24 | getfenv 25 | getmetatable 26 | ipairs 27 | load 28 | loadfile 29 | loadstring 30 | module 31 | next 32 | pairs 33 | pcall 34 | setmetatable 35 | 36 | ## Code/Script? 37 | The current script is below, if you dont know how to use it please look in "How do I use this?" 38 | ```lua 39 | local value = 1 40 | local function randomString(length) 41 | local random = "" 42 | local characters = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"} 43 | for i=1, length do 44 | random = random..characters[math.random(1, #characters)] 45 | end 46 | return random 47 | end 48 | local function obfuscateScript(string) 49 | value = value + 1 50 | math.randomseed(os.time() + value) 51 | --//* Lua 5.1 Functions 52 | local printRandom = randomString(10) 53 | local gRandom = randomString(10) 54 | local versionRandom = randomString(10) 55 | local assertRandom = randomString(10) 56 | local collectgarbageRandom = randomString(10) 57 | local dofileRandom = randomString(10) 58 | local errorRandom = randomString(10) 59 | local getfenvRandom = randomString(10) 60 | local getmtRandom = randomString(10) 61 | local ipairsRandom = randomString(10) 62 | local loadRandom = randomString(10) 63 | local loadfRandom = randomString(10) 64 | local loadstringRandom = randomString(10) 65 | local moduleRandom = randomString(10) 66 | local nextRandom = randomString(10) 67 | local pairsRandom = randomString(10) 68 | local pcallRandom = randomString(10) 69 | local setmtRandom = randomString(10) 70 | --//* Functions End 71 | --//* New Variables 72 | local newPrint = "local "..printRandom.." = print\n" 73 | local newGRandom = "local "..gRandom.." = _G\n" 74 | local newVersionRandom = "local "..versionRandom.." = _VERSION\n" 75 | local newAssert = "local "..assertRandom.." = assert\n" 76 | local newCollectGarbage = "local "..collectgarbageRandom.." = collectgarbage\n" 77 | local newDoFile = "local "..dofileRandom.." = dofile\n" 78 | local newError = "local "..errorRandom.." = error\n" 79 | local newGetFenv = "local "..getfenvRandom.." = getfenv\n" 80 | local newGetMt = "local "..getmtRandom.." = getmetatable\n" 81 | local newIPairs = "local "..ipairsRandom.." = ipairs\n" 82 | local newLoad = "local "..loadRandom.." = load\n" 83 | local newLoadF = "local "..loadfRandom.." = loadfile\n" 84 | local newLoadS = "local "..loadstringRandom.." = loadstring\n" 85 | local newModule = "local "..moduleRandom.." = module\n" 86 | local newNext = "local "..nextRandom.." = next\n" 87 | local newPairs = "local "..pairsRandom.." = pairs\n" 88 | local newPcall = "local "..pcallRandom.." = pcall\n" 89 | local newSetMt = "local "..setmtRandom.." = setmetatable\n" 90 | --//* New Variables End 91 | --//* Pattern Search 92 | string = string.gsub(string, "print", printRandom) 93 | string = string.gsub(string, "_G", gRandom) 94 | string = string.gsub(string, "_VERSION", versionRandom) 95 | string = string.gsub(string, "assert", assertRandom) 96 | string = string.gsub(string, "collectgarbage", collectgarbageRandom) 97 | string = string.gsub(string, "dofile", dofileRandom) 98 | string = string.gsub(string, "error", errorRandom) 99 | string = string.gsub(string, "getfenv", getfenvRandom) 100 | string = string.gsub(string, "getmetatable", getmtRandom) 101 | string = string.gsub(string, "ipairs", ipairsRandom) 102 | string = string.gsub(string, "load", loadRandom) 103 | string = string.gsub(string, "loadfile", loadfRandom) 104 | string = string.gsub(string, "loadstring", loadstringRandom) 105 | string = string.gsub(string, "module", moduleRandom) 106 | string = string.gsub(string, "next", nextRandom) 107 | string = string.gsub(string, "pairs", pairsRandom) 108 | string = string.gsub(string, "pcall", pcallRandom) 109 | string = string.gsub(string, "setmetatable", setmtRandom) 110 | --//* Pattern Search End 111 | --//* Print Obfuscated Script 112 | print(newSetMt..newGetMt..newIPairs..newLoad..newLoadF..newLoadS..newModule..newNext..newPairs..newPcall..newPrint..newGRandom..newVersionRandom..newAssert..newCollectGarbage..newDoFile..newError..newGetFenv..string) 113 | --//* Print Obfuscated Script End 114 | end``` 115 | --------------------------------------------------------------------------------