├── .gitignore
├── LICENSE
├── README.md
├── MLoader.lua
└── module.lua
/.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 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Reboy / M0dder
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | > WARNING: Not recommended for the script which contains secrets. ByteLuaObfuscator is easy to deobfuscate.
2 | > Use other obfuscator
3 | # ByteLuaObfuscator
4 | Simple Lua Bytecode-Method Obfuscator for Lua 5.1+ / RBXLua.
5 | Obfuscator for Lua 5.1 in Lua.
6 | Reboy is me.
7 | Sorry for dirty code but it's obfuscator.
8 | The obfuscator does not have luau support, if you want luau support with the obfuscator, try this: [ShinyMoon](https://github.com/kosuke14/ShinyMoon)
9 | ### Credits
10 | - FiOne LBI (created by same author as Rerubi) - https://github.com/Rerumu/FiOne
11 | - ~~Yueliang 5 (Lua compiler in Lua) - http://yueliang.luaforge.net/~~
12 | - Moonshine (improved version of Yueliang) - https://github.com/gamesys/moonshine
13 | - ARCFOUR implementation in pure Lua (RC4) - https://www.rjek.com/
14 | ## Features
15 | * Convert to bytecode
16 | * Encode bytecode to plain text
17 | * Encrypt encoded code with random password
18 | * Minified code
19 | * Customizable variable name, variable comment, comment
20 | * Lua 5.1 format
21 | * Executable in Lua 5.1+ / RBXLua (no loadstring)
22 | ## Usage of Non-module ver (but you need module)
23 | You will need Lua 5.1: [Lua for windows](https://github.com/rjpcomputing/luaforwindows/releases/tag/v5.1.5-52)
24 | 1. Download module.lua and MLoader.lua
25 | 2. Run MLoader.lua as lua script (cmd > `lua MLoader.lua`)
26 | 3. Type a path to module.lua
27 | 4. Type a path to lua file to obfuscate
28 | 5. Type a path to new lua file to write
29 | 6. Type some options
30 | 7. And it will be obfuscated.
31 | ## Usage (Module ver CLI Usage)
32 | Run this command to view help:
33 | ```sh
34 | lua path/to/module.lua
35 | ```
36 | Help:
37 | ```sh
38 | ByteLuaObfuscator
39 | Copyright (c) 2023 Reboy / M0dder
40 |
41 | Usage:
42 | lua module.lua -s "" -o "" [..]
43 |
44 | Available Arguments:
45 | --help -h Shows help.
46 | -s --source "" Path to Lua script to obfuscate.
47 | -o --output "" Path to Lua script to output (document will be created if there isn't).
48 | -c --comment "" Comment Option.
49 | -vc --varcomm "" Comment Option for lua variable value.
50 | -vn --varname "" Lua variable name (Special characters, spaces will be replaced with underline).
51 | -C --cryptvarcomm Encode (Decodable) comment for vartiable value.
52 |
53 | ```
54 | ## Usage (Module ver)
55 | Require the module:
56 | ```lua
57 | local module = require("path.to.module") -- require module.lua
58 | ```
59 | Call module with these arguments:
60 | ```lua
61 | module( source[, options])
62 | ```
63 | Options table like this:
64 | ```lua
65 | { -- default options
66 | comment = "// CRYPTED", -- ex result: "--// comment"
67 | variablecomment = "lol you have to stop trying to deobfuscate",
68 | cryptvarcomment = true, -- encrypt variablecomment with bytecode ex: "a" -> "\97"
69 | variablename = "CRYPT", -- ex: "local 'variablename' = 'variablecomment'"
70 | }
71 | ```
72 | The module will returns obfuscated source (string, about 20KB~) or error.
73 |
--------------------------------------------------------------------------------
/MLoader.lua:
--------------------------------------------------------------------------------
1 | --[==[
2 | ByteLuaObfuscator Module Loader (Github: kosuke14)
3 | Just execute "lua MLoader.lua" to use.
4 | --]==]
5 |
6 | print("ByteLuaObfuscator (Github: \107\111\115\117\107\101\49\52) Loader (^C to exit)")
7 | print("Put a path to an obfuscator module: ")
8 |
9 | local function getmodule()
10 | io.write("> ")
11 | local mpath = io.read("*l")
12 | local mloaded, module = pcall(function()
13 | return dofile(mpath)
14 | end)
15 | if not mloaded or module == nil then
16 | if not mloaded then
17 | print(module)
18 | end
19 | print("Put a path correctly! (ex: C:\\path\\to\\module.lua)")
20 | return getmodule()
21 | else
22 | return module
23 | end
24 | end
25 | local M_ = getmodule()
26 | if not (M_.crypt ~= nil and type(M_.crypt) == 'function') then
27 | print("Put a path to *module*! Please run loader again.")
28 | return nil
29 | end
30 | local function getRfile()
31 | io.write("> ")
32 | local mpath = io.read("*l")
33 | local mloaded, f, err = pcall(function()
34 | return io.open(mpath, "rb")
35 | end)
36 | if not mloaded or f == nil then
37 | if not mloaded then
38 | print(f)
39 | end
40 | print("Put a path correctly! (ex: savetheoof.lua)")
41 | return getRfile()
42 | else
43 | return f
44 | end
45 | end
46 | print("Put a path to a lua file to obfuscate: ")
47 | local obrfile = getRfile()
48 | local obrcode = obrfile:read("*a")
49 | obrfile:close()
50 |
51 | local function getWfile()
52 | io.write("> ")
53 | local mpath = io.read("*l")
54 | local mloaded, f, err = pcall(function()
55 | return io.open(mpath, "w")
56 | end)
57 | if not mloaded or f == nil then
58 | if not mloaded then
59 | print(f)
60 | end
61 | print("Put a path correctly! (ex: soof_obfuscated.lua)")
62 | return getWfile()
63 | else
64 | return f
65 | end
66 | end
67 | print("Put a path to a lua file to write obfuscated source (new file will be created if not): ")
68 | local wfile = getWfile()
69 |
70 | local _settings = { -- default options
71 | comment = "// CRYPTED", -- "--'comment'"
72 | variablecomment = "lol you have to stop trying to deobfuscate",
73 | cryptvarcomment = true, -- encrypt variablecomment with bytecode
74 | variablename = "CRYPTED", -- "local 'variablename' = 'variablecomment' or something"
75 | }
76 | print("options (Do not enter special characters and leave blank to use default): ")
77 | io.write("Custom Comment [// CRYPTED]> ")
78 | local com_ = io.read("*l")
79 | if com_ == "" then
80 | com_ = _settings.comment
81 | end
82 | io.write("Variable Value String [lol you have to stop trying to deobfuscate]> ")
83 | local varcom_ = io.read("*l")
84 | if varcom_ == "" then
85 | varcom_ = _settings.variablecomment
86 | end
87 | io.write("Variable Name [CRYPTED]> ")
88 | local varnam_ = io.read("*l")
89 | if varnam_ == "" then
90 | varnam_ = _settings.variablecomment
91 | end
92 | io.write("Crypt Var Value [y]/n> ")
93 | local cryvar_ = io.read("*l")
94 | local cryyes = true
95 | if cryvar_:lower() == "n" then
96 | cryyes = false
97 | else
98 | cryyes = true
99 | end
100 | local options_ = {
101 | comment = com_, -- "--'comment'"
102 | variablecomment = varcom_,
103 | cryptvarcomment = cryyes, -- encrypt variablecomment with bytecode
104 | variablename = varnam_, -- "local 'variablename' = 'variablecomment' or something"
105 | }
106 | io.write("Press Enter to continue or ^C to cancel...")io.read()
107 |
108 | local memoryleakerlolwhat = M_(obrcode,options_)
109 |
110 | wfile:write(memoryleakerlolwhat)
111 | wfile:close()
112 | io.write("Done! Press Enter to exit...")io.read()
113 |
--------------------------------------------------------------------------------
/module.lua:
--------------------------------------------------------------------------------
1 | --[==[
2 |
3 | Simple Lua Bytecode Obfuscator
4 |
5 | This code is licensed under the MIT License.
6 | Copyright (c) 2023 Reboy / M0dder
7 |
8 | Made by Reboy / M0dder (Discord: kskreboy#4721)
9 |
10 | Obfuscator Supported Versions:
11 | Only Lua 5.1
12 |
13 | Supported Lua Versions:
14 | Lua 5.1+ / RBXLua (no loadstring)
15 |
16 | Features / How does it work:
17 |
18 | 1. Convert to bytecode
19 | 2. Encode bytecode to plain text
20 | 3. Encrypt encoded code with random password
21 | * Minified code
22 | * Customizable variable name, variable comment, comment
23 | * Executable in Lua 5.1+ / RBXLua (no loadstring)
24 | + new cli
25 |
26 | How to use / Example Usage:
27 |
28 | CLI Usage:
29 |
30 | Command (only --help for help):
31 | lua path/to/module.lua -s "" -o "" [..]
32 |
33 | Example CLI:
34 | lua path/to/module.lua -s "C:\\mycode.lua" -o "result.lua" -c "this code is obfuscated!"
35 |
36 | Lua Code:
37 |
38 | local module = require(path.to.module) -- this module, use require or dofile
39 | module(contents: string (source code), option table: { -- optional
40 | comment = "// comment", -- ex result: "--'comment'"
41 | variablecomment = "lol you have to stop trying to deobfuscate",
42 | cryptvarcomment = true, -- encrypt variablecomment with bytecode ex: "a" -> "\97"
43 | variablename = "CRYPTED", -- ex: "local 'variablename' = 'variablecomment'"
44 | }): string (obfuscated source code)
45 |
46 | Common Issue:
47 | lua has memory limit, so what do i do: Use luvi or srlua to convert obfuscator to binary application, limit will be up to 2gb.
48 |
49 | Example Lua Code:
50 |
51 | -- Obfuscate input.lua and write obfuscated code to result.lua
52 | local codefile, cerr = io.open("input.lua",'rb')
53 | local code
54 | if codefile then
55 | code = codefile:read("*a")
56 | codefile:close()
57 | else
58 | error(cerr)
59 | end
60 | local obfuscated = module(code)
61 | local resfile, rerr = io.open("result.lua",'w')
62 | if resfile then
63 | resfile:write(obfuscated)
64 | resfile:close()
65 | else
66 | print(rerr)
67 | end
68 |
69 | Credits:
70 | - FiOne LBI (created by same author as Rerubi) - https://github.com/Rerumu/FiOne
71 | - ARCFOUR implementation in pure Lua - Rob Kendrick (rjek)
72 |
73 | --]==]
74 | local obversion = "v1.3.1"
75 |
76 | if game ~= nil and typeof ~= nil then
77 | print(
78 | "This Obfuscator cannot be ran in Roblox. (but results can be ran in Roblox)"
79 | )
80 | return
81 | end
82 |
83 | -- check is this cli mode
84 | local climode = arg ~= nil and true or false
85 |
86 | if table.find == nil then
87 | table.find = function(tbl,value,pos)
88 | for i = pos or 1,#tbl do
89 | if tbl[i] == value then
90 | return i
91 | end
92 | end
93 | end
94 | end
95 |
96 | local realargs = nil do
97 | if climode == true then
98 | if #arg <= 1 and arg[1] == "--help" or arg[1] == "-h" or arg[1] == nil then
99 | print(
100 | "ByteLuaObfuscator " .. obversion .. "\n" ..
101 | "Copyright (c) 2023 Reboy / M0dder" .. "\n"
102 | )
103 | print(
104 | "Usage:" .. "\n" ..
105 | arg[0] .. " --source \"\" --output \"\" [OPTIONS]\n" ..
106 | "\n" ..
107 | "Available Arguments:" .. "\n" ..
108 | "--help -h Shows help.\n" ..
109 | "-S --silent Run Obfuscation without outputting to terminal anything." ..
110 | "-s --source \"\" Path to Lua script to obfuscate." .. "\n" ..
111 | "-o --output \"\" Path to Lua script to output (document will be created if there isn't)." .. "\n" ..
112 | "Output file will be overwritten if it exists.\n" ..
113 | "-c --comment \"\" Comment Option." .. "\n" ..
114 | "-vc --varcomm \"\" Comment Option for lua variable value." .. "\n" ..
115 | "-vn --varname \"\" Lua variable name (Special characters, spaces will be replaced with underline)." .. "\n" ..
116 | "-C --cryptvarcomm Encode (Decodable) comment for vartiable value." .. "\n" ..
117 | "-f --force Ignores all warnings.\n" ..
118 | "-of --openfile Open an obfuscated file after obfuscation. (Windows: notepad, Unix: '$EDITOR')\n" ..
119 | "" .. "\n"
120 | )
121 | return
122 | end
123 | realargs = {}
124 | local nextvargs = {"source","output","comment","varcomm","varname"}
125 | local longargs = {s="source",o="output",c="comment",vc="varcomm",vn="varname",C="cryptvarcomm",f="force",S="silent",of="openfile"}
126 | local skipdexes = {}
127 | for i,v in pairs(arg) do
128 | if (not table.find(skipdexes,i)) or (i > 0) then
129 | if v:sub(1,2) == "--" then
130 | if table.find(nextvargs,v:sub(3)) then
131 | realargs[v:sub(3)] = arg[i+1]
132 | table.insert(skipdexes,(#skipdexes+1),(i+1))
133 | else
134 | realargs[v:sub(3)] = true
135 | end
136 | elseif v:sub(1,1) == "-" then
137 | if table.find(nextvargs,longargs[v:sub(2)]) then
138 | realargs[longargs[v:sub(2)]] = arg[i+1]
139 | table.insert(skipdexes,(#skipdexes+1),(i+1))
140 | else
141 | realargs[longargs[v:sub(2)]] = true
142 | end
143 | end
144 | end
145 | end
146 | end
147 | end
148 |
149 | local M = {}
150 |
151 | local charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'--64
152 | local morecharset = charset..'!@#$%&*()-=[];\'",./_+{}:|<>?'
153 | local fenv = getfenv or function()
154 | return _ENV
155 | end
156 |
157 | --local loadstring_ = loadstring
158 |
159 | local resources = { -- FAKE Yueliang
160 | Yueliang = function(src,NAME)return string.dump(assert(loadstring(src,NAME)))end,
161 | -- FiOne
162 | FiOneCode = [==[(function()if not bit then local bit_=nil pcall(function()bit_=require('bit') end)bit=bit_ end local bit=bit or bit32 or(function()local a={_TYPE='module',_NAME='bit.numberlua',_VERSION='0.3.1.20120131'}local b=math.floor;local c=2^32;local d=c-1;local function e(f)local g={}local h=setmetatable({},g)function g:__index(i)local j=f(i)h[i]=j;return j end;return h end;local function k(h,l)local function m(n,o)local p,q=0,1;while n~=0 and o~=0 do local r,s=n%l,o%l;p=p+h[r][s]*q;n=(n-r)/l;o=(o-s)/l;q=q*l end;p=p+(n+o)*q;return p end;return m end;local function t(h)local u=k(h,2^1)local v=e(function(n)return e(function(o)return u(n,o)end)end)return k(v,2^(h.n or 1))end;function a.tobit(w)return w%2^32 end;a.bxor=t{[0]={[0]=0,[1]=1},[1]={[0]=1,[1]=0},n=4}local x=a.bxor;function a.bnot(n)return d-n end;local y=a.bnot;function a.band(n,o)return(n+o-x(n,o))/2 end;local z=a.band;function a.bor(n,o)return d-z(d-n,d-o)end;local A=a.bor;local B,C;function a.rshift(n,D)if D<0 then return B(n,-D)end;return b(n%2^32/2^D)end;C=a.rshift;function a.lshift(n,D)if D<0 then return C(n,-D)end;return n*2^D%2^32 end;B=a.lshift;function a.tohex(w,E)E=E or 8;local F;if E<=0 then if E==0 then return''end;F=true;E=-E end;w=z(w,16^E-1)return('%0'..E..(F and'X'or'x')):format(w)end;local G=a.tohex;function a.extract(E,H,I)I=I or 1;return z(C(E,H),2^I-1)end;local J=a.extract;function a.replace(E,j,H,I)I=I or 1;local K=2^I-1;j=z(j,K)local L=y(B(K,H))return z(E,L)+B(j,H)end;local M=a.replace;function a.bswap(w)local n=z(w,0xff)w=C(w,8)local o=z(w,0xff)w=C(w,8)local N=z(w,0xff)w=C(w,8)local O=z(w,0xff)return B(B(B(n,8)+o,8)+N,8)+O end;local P=a.bswap;function a.rrotate(w,D)D=D%32;local Q=z(w,2^D-1)return C(w,D)+B(Q,32-D)end;local R=a.rrotate;function a.lrotate(w,D)return R(w,-D)end;local S=a.lrotate;a.rol=a.lrotate;a.ror=a.rrotate;function a.arshift(w,D)local T=C(w,D)if w>=0x80000000 then T=T+B(2^D-1,32-D)end;return T end;local U=a.arshift;function a.btest(w,V)return z(w,V)~=0 end;a.bit32={}local function W(w)return(-1-w)%c end;a.bit32.bnot=W;local function X(n,o,N,...)local T;if o then n=n%c;o=o%c;T=x(n,o)if N then T=X(T,N,...)end;return T elseif n then return n%c else return 0 end end;a.bit32.bxor=X;local function Y(n,o,N,...)local T;if o then n=n%c;o=o%c;T=(n+o-x(n,o))/2;if N then T=Y(T,N,...)end;return T elseif n then return n%c else return d end end;a.bit32.band=Y;local function Z(n,o,N,...)local T;if o then n=n%c;o=o%c;T=d-z(d-n,d-o)if N then T=Z(T,N,...)end;return T elseif n then return n%c else return 0 end end;a.bit32.bor=Z;function a.bit32.btest(...)return Y(...)~=0 end;function a.bit32.lrotate(w,D)return S(w%c,D)end;function a.bit32.rrotate(w,D)return R(w%c,D)end;function a.bit32.lshift(w,D)if D>31 or D<-31 then return 0 end;return B(w%c,D)end;function a.bit32.rshift(w,D)if D>31 or D<-31 then return 0 end;return C(w%c,D)end;function a.bit32.arshift(w,D)w=w%c;if D>=0 then if D>31 then return w>=0x80000000 and d or 0 else local T=C(w,D)if w>=0x80000000 then T=T+B(2^D-1,32-D)end;return T end else return B(w,-D)end end;function a.bit32.extract(w,H,...)local I=...or 1;if H<0 or H>31 or I<0 or H+I>32 then error'out of range'end;w=w%c;return J(w,H,...)end;function a.bit32.replace(w,j,H,...)local I=...or 1;if H<0 or H>31 or I<0 or H+I>32 then error'out of range'end;w=w%c;j=j%c;return M(w,j,H,...)end;a.bit={}function a.bit.tobit(w)w=w%c;if w>=0x80000000 then w=w-c end;return w end;local _=a.bit.tobit;function a.bit.tohex(w,...)return G(w%c,...)end;function a.bit.bnot(w)return _(y(w%c))end;local function a0(n,o,N,...)if N then return a0(a0(n,o),N,...)elseif o then return _(A(n%c,o%c))else return _(n)end end;a.bit.bor=a0;local function a1(n,o,N,...)if N then return a1(a1(n,o),N,...)elseif o then return _(z(n%c,o%c))else return _(n)end end;a.bit.band=a1;local function a2(n,o,N,...)if N then return a2(a2(n,o),N,...)elseif o then return _(x(n%c,o%c))else return _(n)end end;a.bit.bxor=a2;function a.bit.lshift(w,E)return _(B(w%c,E%32))end;function a.bit.rshift(w,E)return _(C(w%c,E%32))end;function a.bit.arshift(w,E)return _(U(w%c,E%32))end;function a.bit.rol(w,E)return _(S(w%c,E%32))end;function a.bit.ror(w,E)return _(R(w%c,E%32))end;function a.bit.bswap(w)return _(P(w%c))end;return a end)()local unpack=table.unpack or unpack;local a3;local a4;local a5;local a6=50;local a7={[22]=18,[31]=8,[33]=28,[0]=3,[1]=13,[2]=23,[26]=33,[12]=1,[13]=6,[14]=10,[15]=16,[16]=20,[17]=26,[18]=30,[19]=36,[3]=0,[4]=2,[5]=4,[6]=7,[7]=9,[8]=12,[9]=14,[10]=17,[20]=19,[21]=22,[23]=24,[24]=27,[25]=29,[27]=32,[32]=34,[34]=37,[11]=5,[28]=11,[29]=15,[30]=21,[35]=25,[36]=31,[37]=35}local a8={[0]='ABC','ABx','ABC','ABC','ABC','ABx','ABC','ABx','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','AsBx','ABC','ABC','ABC','ABC','ABC','ABC','ABC','ABC','AsBx','AsBx','ABC','ABC','ABC','ABx','ABC'}local a9={[0]={b='OpArgR',c='OpArgN'},{b='OpArgK',c='OpArgN'},{b='OpArgU',c='OpArgU'},{b='OpArgR',c='OpArgN'},{b='OpArgU',c='OpArgN'},{b='OpArgK',c='OpArgN'},{b='OpArgR',c='OpArgK'},{b='OpArgK',c='OpArgN'},{b='OpArgU',c='OpArgN'},{b='OpArgK',c='OpArgK'},{b='OpArgU',c='OpArgU'},{b='OpArgR',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgR',c='OpArgN'},{b='OpArgR',c='OpArgN'},{b='OpArgR',c='OpArgN'},{b='OpArgR',c='OpArgR'},{b='OpArgR',c='OpArgN'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgK',c='OpArgK'},{b='OpArgR',c='OpArgU'},{b='OpArgR',c='OpArgU'},{b='OpArgU',c='OpArgU'},{b='OpArgU',c='OpArgU'},{b='OpArgU',c='OpArgN'},{b='OpArgR',c='OpArgN'},{b='OpArgR',c='OpArgN'},{b='OpArgN',c='OpArgU'},{b='OpArgU',c='OpArgU'},{b='OpArgN',c='OpArgN'},{b='OpArgU',c='OpArgN'},{b='OpArgU',c='OpArgN'}}local function aa(ab,s,e,d)local ac=0;for i=s,e,d do ac=ac+string.byte(ab,i,i)*256^(i-s)end;return ac end;local function ad(ae,af,ag,ah)local ai=(-1)^bit.rshift(ah,7)local aj=bit.rshift(ag,7)+bit.lshift(bit.band(ah,0x7F),1)local ak=ae+bit.lshift(af,8)+bit.lshift(bit.band(ag,0x7F),16)local al=1;if aj==0 then if ak==0 then return ai*0 else al=0;aj=1 end elseif aj==0x7F then if ak==0 then return ai*1/0 else return ai*0/0 end end;return ai*2^(aj-127)*(1+al/2^23)end;local function am(ae,af,ag,ah,an,ao,ap,aq)local ai=(-1)^bit.rshift(aq,7)local aj=bit.lshift(bit.band(aq,0x7F),4)+bit.rshift(ap,4)local ak=bit.band(ap,0x0F)*2^48;local al=1;ak=ak+ao*2^40+an*2^32+ah*2^24+ag*2^16+af*2^8+ae;if aj==0 then if ak==0 then return ai*0 else al=0;aj=1 end elseif aj==0x7FF then if ak==0 then return ai*1/0 else return ai*0/0 end end;return ai*2^(aj-1023)*(al+ak/2^52)end;local function ar(ab,s,e)return aa(ab,s,e-1,1)end;local function as(ab,s,e)return aa(ab,e-1,s,-1)end;local function at(ab,s)return ad(string.byte(ab,s,s+3))end;local function au(ab,s)local ae,af,ag,ah=string.byte(ab,s,s+3)return ad(ah,ag,af,ae)end;local function av(ab,s)return am(string.byte(ab,s,s+7))end;local function aw(ab,s)local ae,af,ag,ah,an,ao,ap,aq=string.byte(ab,s,s+7)return am(aq,ap,ao,an,ah,ag,af,ae)end;local ax={[4]={little=at,big=au},[8]={little=av,big=aw}}local function ay(S)local az=S.index;local aA=string.byte(S.source,az,az)S.index=az+1;return aA end;local function aB(S,aC)local aD=S.index+aC;local aE=string.sub(S.source,S.index,aD-1)S.index=aD;return aE end;local function aF(S)local aC=S:s_szt()local aE;if aC~=0 then aE=string.sub(aB(S,aC),1,-2)end;return aE end;local function aG(aC,aH)return function(S)local aD=S.index+aC;local aI=aH(S.source,S.index,aD)S.index=aD;return aI end end;local function aJ(aC,aH)return function(S)local aK=aH(S.source,S.index)S.index=S.index+aC;return aK end end;local function aL(S)local aM=S:s_int()local aN={}for i=1,aM do local aO=S:s_ins()local aP=bit.band(aO,0x3F)local aQ=a8[aP]local aR=a9[aP]local aS={value=aO,op=a7[aP],A=bit.band(bit.rshift(aO,6),0xFF)}if aQ=='ABC'then aS.B=bit.band(bit.rshift(aO,23),0x1FF)aS.C=bit.band(bit.rshift(aO,14),0x1FF)aS.is_KB=aR.b=='OpArgK'and aS.B>0xFF;aS.is_KC=aR.c=='OpArgK'and aS.C>0xFF elseif aQ=='ABx'then aS.Bx=bit.band(bit.rshift(aO,14),0x3FFFF)aS.is_K=aR.b=='OpArgK'elseif aQ=='AsBx'then aS.sBx=bit.band(bit.rshift(aO,14),0x3FFFF)-131071 end;aN[i]=aS end;return aN end;local function aT(S)local aM=S:s_int()local aU={}for i=1,aM do local aV=ay(S)local k;if aV==1 then k=ay(S)~=0 elseif aV==3 then k=S:s_num()elseif aV==4 then k=aF(S)end;aU[i]=k end;return aU end;local function aW(S,ab)local aM=S:s_int()local aX={}for i=1,aM do aX[i]=a5(S,ab)end;return aX end;local function aY(S)local aM=S:s_int()local aZ={}for i=1,aM do aZ[i]=S:s_int()end;return aZ end;local function a_(S)local aM=S:s_int()local b0={}for i=1,aM do b0[i]={varname=aF(S),startpc=S:s_int(),endpc=S:s_int()}end;return b0 end;local function b1(S)local aM=S:s_int()local b2={}for i=1,aM do b2[i]=aF(S)end;return b2 end;function a5(S,b3)local b4={}local ab=aF(S)or b3;b4.source=ab;S:s_int()S:s_int()b4.numupvals=ay(S)b4.numparams=ay(S)ay(S)ay(S)b4.code=aL(S)b4.const=aT(S)b4.subs=aW(S,ab)b4.lines=aY(S)a_(S)b1(S)for _,v in ipairs(b4.code)do if v.is_K then v.const=b4.const[v.Bx+1]else if v.is_KB then v.const_B=b4.const[v.B-0xFF]end;if v.is_KC then v.const_C=b4.const[v.C-0xFF]end end end;return b4 end;function a3(ab)local b5;local b6;local b7;local b8;local b9;local ba;local bb;local bc={index=1,source=ab}assert(aB(bc,4)=='\27Lua','invalid Lua signature')assert(ay(bc)==0x51,'invalid Lua version')assert(ay(bc)==0,'invalid Lua format')b6=ay(bc)~=0;b7=ay(bc)b8=ay(bc)b9=ay(bc)ba=ay(bc)bb=ay(bc)~=0;b5=b6 and ar or as;bc.s_int=aG(b7,b5)bc.s_szt=aG(b8,b5)bc.s_ins=aG(b9,b5)if bb then bc.s_num=aG(ba,b5)elseif ax[ba]then bc.s_num=aJ(ba,ax[ba][b6 and'little'or'big'])else error('unsupported float size')end;return a5(bc,'@virtual')end;local function bd(be,bf)for i,bg in pairs(be)do if bg.index>=bf then bg.value=bg.store[bg.index]bg.store=bg;bg.index='value'be[i]=nil end end end;local function bh(be,bf,bi)local bj=be[bf]if not bj then bj={index=bf,store=bi}be[bf]=bj end;return bj end;local function bk(...)return select('#',...),{...}end;local function bl(bm,bn)local ab=bm.source;local bo=bm.lines[bm.pc-1]local b3,bp,bq=string.match(bn,'^(.-):(%d+):%s+(.+)')local br='%s:%i: [%s:%i] %s'bo=bo or'0'b3=b3 or'?'bp=bp or'0'bq=bq or bn;error(string.format(br,ab,bo,b3,bp,bq),0)end;local function bs(bm)local aN=bm.code;local bt=bm.subs;local bu=bm.env;local bv=bm.upvals;local bw=bm.varargs;local bx=-1;local by={}local bi=bm.stack;local bz=bm.pc;while true do local bA=aN[bz]local aP=bA.op;bz=bz+1;if aP<18 then if aP<8 then if aP<3 then if aP<1 then for i=bA.A,bA.B do bi[i]=nil end elseif aP>1 then local bg=bv[bA.B]bi[bA.A]=bg.store[bg.index]else local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;bi[bA.A]=bB+bC end elseif aP>3 then if aP<6 then if aP>4 then local A=bA.A;local B=bA.B;local bf;if bA.is_KC then bf=bA.const_C else bf=bi[bA.C]end;bi[A+1]=bi[B]bi[A]=bi[B][bf]else bi[bA.A]=bu[bA.const]end elseif aP>6 then local bf;if bA.is_KC then bf=bA.const_C else bf=bi[bA.C]end;bi[bA.A]=bi[bA.B][bf]else local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;bi[bA.A]=bB-bC end else bi[bA.A]=bi[bA.B]end elseif aP>8 then if aP<13 then if aP<10 then bu[bA.const]=bi[bA.A]elseif aP>10 then if aP<12 then local A=bA.A;local B=bA.B;local C=bA.C;local bD;local bE,bF;if B==0 then bD=bx-A else bD=B-1 end;bE,bF=bk(bi[A](unpack(bi,A+1,A+bD)))if C==0 then bx=A+bE-1 else bE=C-1 end;for i=1,bE do bi[A+i-1]=bF[i]end else local bg=bv[bA.B]bg.store[bg.index]=bi[bA.A]end else local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;bi[bA.A]=bB*bC end elseif aP>13 then if aP<16 then if aP>14 then local A=bA.A;local B=bA.B;local bD;if B==0 then bD=bx-A else bD=B-1 end;bd(by,0)return bk(bi[A](unpack(bi,A+1,A+bD)))else local bf,bG;if bA.is_KB then bf=bA.const_B else bf=bi[bA.B]end;if bA.is_KC then bG=bA.const_C else bG=bi[bA.C]end;bi[bA.A][bf]=bG end elseif aP>16 then bi[bA.A]={}else local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;bi[bA.A]=bB/bC end else bi[bA.A]=bA.const end else local A=bA.A;local bH=bi[A+2]local bf=bi[A]+bH;local bI=bi[A+1]local bJ;if bH==math.abs(bH)then bJ=bf<=bI else bJ=bf>=bI end;if bJ then bi[bA.A]=bf;bi[bA.A+3]=bf;bz=bz+bA.sBx end end elseif aP>18 then if aP<28 then if aP<23 then if aP<20 then bi[bA.A]=#bi[bA.B]elseif aP>20 then if aP<22 then local A=bA.A;local B=bA.B;local bK={}local aM;if B==0 then aM=bx-A+1 else aM=B-1 end;for i=1,aM do bK[i]=bi[A+i-1]end;bd(by,0)return aM,bK else local aE=bi[bA.B]for i=bA.B+1,bA.C do aE=aE..bi[i]end;bi[bA.A]=aE end else local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;bi[bA.A]=bB%bC end elseif aP>23 then if aP<26 then if aP>24 then bd(by,bA.A)else local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;if bB==bC==(bA.A~=0)then bz=bz+aN[bz].sBx end;bz=bz+1 end elseif aP>26 then local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;if bB28 then if aP<33 then if aP<30 then local bB,bC;if bA.is_KB then bB=bA.const_B else bB=bi[bA.B]end;if bA.is_KC then bC=bA.const_C else bC=bi[bA.C]end;if bB<=bC==(bA.A~=0)then bz=bz+aN[bz].sBx end;bz=bz+1 elseif aP>30 then if aP<32 then local aX=bt[bA.Bx+1]local bL=aX.numupvals;local bM;if bL~=0 then bM={}for i=1,bL do local bN=aN[bz+i-1]if bN.op==a7[0]then bM[i-1]=bh(by,bN.B,bi)elseif bN.op==a7[4]then bM[i-1]=bv[bN.B]end end;bz=bz+bL end;bi[bA.A]=a4(aX,bu,bM)else local A=bA.A;local B=bA.B;if not bi[B]==(bA.C~=0)then bz=bz+1 else bi[A]=bi[B]end end else bi[bA.A]=-bi[bA.B]end elseif aP>33 then if aP<36 then if aP>34 then local A=bA.A;local aM=bA.B;if aM==0 then aM=bw.size;bx=A+aM-1 end;for i=1,aM do bi[A+i-1]=bw.list[i]end else local A=bA.A;local bO,bI,bH;bO=assert(tonumber(bi[A]),'`for` initial value must be a number')bI=assert(tonumber(bi[A+1]),'`for` limit must be a number')bH=assert(tonumber(bi[A+2]),'`for` step must be a number')bi[A]=bO-bH;bi[A+1]=bI;bi[A+2]=bH;bz=bz+bA.sBx end elseif aP>36 then local A=bA.A;local C=bA.C;local aM=bA.B;local bP=bi[A]local bQ;if aM==0 then aM=bx-A end;if C==0 then C=bA[bz].value;bz=bz+1 end;bQ=(C-1)*a6;for i=1,aM do bP[i+bQ]=bi[A+i]end else bi[bA.A]=not bi[bA.B]end else if not bi[bA.A]==(bA.C~=0)then bz=bz+1 end end else local A=bA.A;local aH=bi[A]local bR=bi[A+1]local bf=bi[A+2]local bS=A+3;local bK;bi[bS+2]=bf;bi[bS+1]=bR;bi[bS]=aH;bK={aH(bR,bf)}for i=1,bA.C do bi[bS+i-1]=bK[i]end;if bi[bS]~=nil then bi[A+2]=bi[bS]else bz=bz+1 end end else bz=bz+bA.sBx end;bm.pc=bz end end;function a4(bR,bu,b2)local bT=bR.code;local bU=bR.subs;local bV=bR.lines;local bW=bR.source;local bX=bR.numparams;local function bY(...)local bi={}local bZ={}local b_=0;local c0,c1=bk(...)local bm;local c2,bn,bK;for i=1,bX do bi[i-1]=c1[i]end;if bX0 and'1'or'0')end;return d end)..'0000'):gsub('%d%d%d?%d?%d?%d?',function(c)if#c<6 then return''end;local f=0;for e=1,6 do f=f+(c:sub(e,e)=='1'and 2^(6-e)or 0)end;return b:sub(f+1,f+1)end)..({'','==','='})[#a%3+1]end,
167 | Decode = function(a)local b=charset;a=string.gsub(a,'[^'..b..'=]','')return a:gsub('.',function(c)if c=='='then return''end;local d,e='',b:find(c)-1;for f=6,1,-1 do d=d..(e%2^f-e%2^(f-1)>0 and'1'or'0')end;return d end):gsub('%d%d%d?%d?%d?%d?%d?%d?',function(c)if#c~=8 then return''end;local g=0;for f=1,8 do g=g+(c:sub(f,f)=='1'and 2^(8-f)or 0)end;return string.char(g)end)end
168 | },
169 | Base64Code = {
170 | Encode = [==[function(a)local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';return(a:gsub('.',function(c)local d,b='',c:byte()for e=8,1,-1 do d=d..(b%2^e-b%2^(e-1)>0 and'1'or'0')end;return d end)..'0000'):gsub('%d%d%d?%d?%d?%d?',function(c)if#c<6 then return''end;local f=0;for e=1,6 do f=f+(c:sub(e,e)=='1'and 2^(6-e)or 0)end;return b:sub(f+1,f+1)end)..({'','==','='})[#a%3+1]end]==],
171 | Decode = [==[function(a)local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';a=string.gsub(a,'[^'..b..'=]','')return a:gsub('.',function(c)if c=='='then return''end;local d,e='',b:find(c)-1;for f=6,1,-1 do d=d..(e%2^f-e%2^(f-1)>0 and'1'or'0')end;return d end):gsub('%d%d%d?%d?%d?%d?%d?%d?',function(c)if#c~=8 then return''end;local g=0;for f=1,8 do g=g+(c:sub(f,f)=='1'and 2^(8-f)or 0)end;return string.char(g)end)end]==]
172 | },
173 | };
174 |
175 | --Resources:
176 | -- ~~Compiler: Yueliang(source, scriptname): luac string | Executor: FiOne(luac, env): function~~
177 | -- Base64: Base64.Encode(data): string | Base64.Decode(data): string
178 | -- "FiOneCode" loadstringable string
179 | -- AES: AES(key) - and something
180 | -- AESCode: src of aes
181 | -- Base64Code: src of base64 Encode, Decode
182 | --
183 | function loaddata(name)
184 | return resources[name]
185 | end
186 |
187 | local compile = loaddata("Yueliang")
188 | --local execute = loaddata("FiOne")
189 |
190 | do
191 | --loadstring = function(contents, chunkname, env) -- wow custom loadstring
192 | -- local bytecode = compile(contents, chunkname or nil)
193 | -- local func = execute(bytecode, env or fenv(2))
194 | -- return func
195 | --end
196 | --resources.FiOne = loadstring("return " .. loaddata("AESCode"))()
197 | resources.AES = loadstring("return " .. loaddata("AESCode"))()
198 | end
199 |
200 | local _settings = { -- default options
201 | comment = "// CRYPTED", -- "--'comment'"
202 | variablecomment = "lol you have to stop trying to deobfuscate",
203 | cryptvarcomment = true, -- encrypt variablecomment with bytecode
204 | variablename = "CRYPTED", -- "local 'variablename' = 'variablecomment' or something"
205 | }
206 |
207 | local aes = loaddata("AES")
208 | local base64 = loaddata("Base64")
209 | local function aesenc(code, key)
210 | local state = aes(key)
211 | local unable = state:cipher(code)
212 | local able = base64.Encode(unable)
213 | return able
214 | end
215 |
216 | local function aesdec(code, key)
217 | local state = aes(key)
218 | local unable = base64.Decode(code)
219 | local result = state:cipher(unable)
220 | return result
221 | end
222 |
223 | local function genpass(l)
224 | local pass = ""
225 | for i = 1, l do
226 | local a = math.random(1,#morecharset)
227 | pass = pass .. morecharset:sub(a,a)
228 | end
229 | return pass
230 | end
231 |
232 | local h2b = {
233 | ['0']='0000', ['1']='0001', ['2']='0010', ['3']='0011',
234 | ['4']='0100', ['5']='0101', ['6']='0110', ['7']='0111',
235 | ['8']='1000', ['9']='1001', ['A']='1010', ['B']='1011',
236 | ['C']='1100', ['D']='1101', ['E']='1110', ['F']='1111'
237 | }
238 | local function d2b(n)
239 | return ('%X'):format(n):upper():gsub(".", h2b)
240 | end
241 | local function genIl(a)
242 | return d2b((a):byte(1,-1)):gsub("0","l"):gsub("1","I")
243 | end
244 | local silentmode = climode and realargs.silent or false
245 | if silentmode == false then
246 | print(
247 | "ByteLuaObfuscator " .. obversion .. "\n" ..
248 | "Copyright (c) 2023 Reboy / M0dder" .. "\n"
249 | )
250 | end
251 | M.crypt = function(source, options)
252 | if silentmode == false and #source >= 2000000 then
253 | print("WARNING: Your script seems too big, the process may be crashed or the code may be corrupted.")
254 | end
255 | options = options or {}
256 | for k,v in pairs(_settings) do
257 | if options[k] == nil then
258 | options[k] = v
259 | end
260 | end
261 | options.variablename = options.variablename:gsub('[%p%c%s]', '_')
262 | options.variablename = options.variablename:sub(1,1):gsub('[%d]','v'..options.variablename:sub(1,1)) .. options.variablename:sub(2)
263 | local varname = options.variablename
264 | local varcomment = options.cryptvarcomment and "\\"..table.concat({options.variablecomment:byte(1,-1)},"\\") or options.variablecomment
265 | local comment = options.comment
266 |
267 | -- f%d_%a -- fake
268 | -- c%d_%a -- real
269 | if not silentmode then print("Obfuscating | Code conversion...")end
270 | local succ, luac = pcall(function()
271 | return compile(source, "gg_y")
272 | end)
273 | if succ == false then
274 | print("Lua Error")
275 | return error(luac)
276 | end
277 | collectgarbage()
278 | if not silentmode then print("Obfuscating | Encrypting...")end
279 | local r_key = "return(function()"
280 | local fv_z = ("local %s%s = \"%s\";"):format(varname, genIl("z"), varcomment)
281 | local f1_a = ("local %s%s"):format(varname, genIl("a"))
282 | local f2_b = ("local %s%s"):format(varname, genIl("b"))
283 | local f3_c = ("local %s%s"):format(varname, genIl("c"))
284 | local c1_d = ("local %s%s"):format(varname, genIl("d"))
285 | local f4_e = ("local %s%s"):format(varname, genIl("e"))
286 | local f5_f = ("local %s%s"):format(varname, genIl("f"))
287 | local f6_g = ("local %s%s"):format(varname, genIl("g"))
288 | local passkey = genpass(math.random(10,20))
289 | local encsrc = aesenc(base64.Encode(luac), passkey)
290 | local key64 = base64.Encode(passkey)
291 | collectgarbage()
292 | if not silentmode then print("Obfuscating | Code Building...")end
293 | local f4 = f4_e .. "=" .. ("'%s'"):format(base64.Encode(genpass(math.random(10,20))))
294 | local f5 = f5_f .. "=" .. ("'%s'"):format(varcomment)
295 | local f6 = f6_g .. "=" .. ("'%s'"):format(base64.Encode(genpass(math.random(10,20))))
296 | local c1 = c1_d .. "=" .. ("'%s'"):format("\\"..table.concat({key64:byte(1,-1)},"\\"))
297 | local fks = {f4,f5,f6,c1}
298 | local i_ = ("%s%s"):format(varname, genIl("i"))
299 | local c2_i_b64 = ("local %s"):format(i_) .. "=" .. loaddata("Base64Code").Decode
300 | local j_ = ("%s%s"):format(varname, genIl("j"))
301 | local c3_j_aes = ("local %s"):format(j_) .. "=" .. loaddata("AESCode")
302 | local k_ = ("%s%s"):format(varname, genIl("k"))
303 | local c4_k_fne = ("local %s"):format(k_) .. "=" .. loaddata("FiOneCode")
304 | local f7_h = [[function ]]..("%s%s"):format(varname, genIl("h"))..[[(a,b)local c=]]..i_..[[(a,b);local d=]]..f4_e:sub(7)..[[;return c,d end]]
305 | local f8_l = ("%s%s"):format(varname, genIl("h"))..("(%s,%d)"):format(f5_f:sub(7),math.random(314,31415))
306 | local m_ = ("%s%s"):format(varname, genIl("m"))
307 | local c4_m = ("local %s"):format(m_) .. "=" .. "function(a,b)" ..--a.64key,b.64src
308 | "local c="..j_.."("..i_.."(a))" ..
309 | "local d=c[\"\\99\\105\\112\\104\\101\\114\"](c,"..i_.."(b))" ..
310 | "return "..i_.."(d)" ..
311 | "end"
312 | local n_ = ("%s%s"):format(varname, genIl("n"))
313 | local bytedsrc = nil
314 | if encsrc:len() > 255 then -- handle lua byte library limit
315 | local chunkedbys = {}
316 | for i=1,#encsrc,255 do
317 | chunkedbys[#chunkedbys+1] = {encsrc:sub(i,i+255 - 1):byte(1,-1)}
318 | end
319 | bytedsrc = {}
320 | for i,v in pairs(chunkedbys) do
321 | for i1,v1 in pairs(v) do
322 | bytedsrc[#bytedsrc+1] = v1
323 | end
324 | end
325 | else
326 | bytedsrc = {encsrc:byte(1,-1)}
327 | end
328 | local c5res = "\\"..table.concat(bytedsrc,"\\")
329 | local c5_n = ("local %s"):format(n_) .. "="..("\"%s\""):format(c5res)
330 | local fenvhandle = "local fev=getfenv or function()return _ENV end"
331 | local f9_o = ("local %s%s"):format(varname, genIl("o")) .. "=" .. ("'%s%s%s'"):format(base64.Encode(genpass(math.random(10,20))),base64.Encode(genpass(math.random(10,20))),base64.Encode(genpass(math.random(10,20))))
332 | local c_end = ("return %s(%s(%s,%s),getfenv(0))()end)()"):format(k_,m_,(c1_d):sub(7),n_)--1.exe,2.c4,3.c4_a,4.c4_b
333 | if not silentmode then print("Obfuscated!")end
334 | return "--" .. comment .. "\n\n" ..
335 | r_key ..
336 | fv_z ..
337 | fv_z ..
338 | fv_z ..
339 | f1_a .. "=" .. ("%d"):format(math.random(111,31415)/100) .. ";" ..
340 | f2_b .. "=" .. ("%d"):format(math.random(111,31415)/100) .. ";" ..
341 | f3_c .. "=" .. ("%d"):format(math.pi) .. ";" ..
342 | c2_i_b64 .. ";" ..
343 | f2_b .. "=" .. ("%d"):format(math.random(111,31415)/100) .. ";" ..
344 | c3_j_aes .. ";" ..
345 | fenvhandle .. ";" ..
346 | c4_k_fne .. ";" ..
347 | fks[math.random(1,#fks)] .. ";" ..
348 | c5_n .. ";" ..
349 | fks[math.random(1,#fks)] .. ";" ..
350 | fks[math.random(1,#fks)] .. ";" ..
351 | c4_m .. ";" ..
352 | fks[math.random(1,#fks)] .. ";" ..
353 | c1 .. ";" ..
354 | fks[math.random(1,#fks)] .. ";" ..
355 | f9_o .. ";" ..
356 | f7_h .. ";" ..
357 | c_end
358 | end
359 |
360 | if climode == true then
361 | if silentmode == false and not realargs.force then
362 | local existfile = io.open(realargs.output or "output.lua","r")
363 | if existfile ~= nil then
364 | io.close(existfile)
365 | print("Output file is exist: " .. realargs.output or "output.lua")
366 | io.write("Would you like to overwrite it? (y/N) ")
367 | local answer = io.read()
368 | if answer:lower():sub(1,1) ~= "y" then
369 | print("Cancelled")
370 | return
371 | end
372 | end
373 | end
374 | local rsuccess, readdfile, rerr = pcall(function()
375 | return io.open(realargs.source, "rb")
376 | end)
377 | if rsuccess == false or readdfile == nil then
378 | print("File (source file) Reading Error: " .. (rsuccess == false and readdfile or rerr or "Unknown"))
379 | return
380 | end
381 | if not silentmode then print(("Selected source file to \"%s\"."):format(realargs.source))end
382 | local wsuccess, wdfile, werr = pcall(function()
383 | return io.open(realargs.output or "output.lua", "w")
384 | end)
385 | if wsuccess == false or wdfile == nil then
386 | readdfile:close()
387 | print("File (output file) Writing Error: " .. (wsuccess == false and wdfile or werr or "Unknown"))
388 | return
389 | end
390 | if not silentmode then print(("Selected output file to \"%s\"."):format(realargs.output or "output.lua"))end
391 | local clisettings = {
392 | comment = realargs.comment or _settings.comment, -- --comment "string"
393 | variablecomment = realargs.varcomm or _settings.variablecomment, -- --varcomm "string"
394 | cryptvarcomment = realargs.cryptvarcomm or false, -- --cryptvarcomm
395 | variablename = realargs.varname or _settings.variablename, -- --varname "string"
396 | }
397 | collectgarbage()
398 | local starttime = os.clock()
399 | if not silentmode then print("Starting obfuscation.")end
400 | local kb = M.crypt(readdfile:read("*a"),clisettings) -- you need more memory if you get error at here
401 | if not silentmode then print(("Finished obfuscation in %f seconds."):format(os.clock() - starttime))end
402 | readdfile:close()
403 | wdfile:write(kb)
404 | wdfile:close()
405 | kb = nil
406 | if not silentmode then print(("Obfuscated code are written to \"%s\"."):format(realargs.output or "output.lua"))end
407 | if not silentmode then print("All done.")end
408 | if realargs.openfile then
409 | os.execute((package.config:sub(1,1) == "\\" and "" or (os.getenv("EDITOR") .. " "))..(realargs.output or "output.lua") .. " &")
410 | end
411 | return
412 | end
413 |
414 | return setmetatable(M, {
415 | __call = function(self, source, options)
416 | return self.crypt(source, options)
417 | end,
418 | })
419 |
--------------------------------------------------------------------------------