r/lua • u/Sp0tters • Aug 16 '25
How do I even make a lua obfuscator?
I know someone already ask this but im asking like how does it work tbh I dont mind if it was fully made using lua like that prometheus obfuscator or using c or java of whatever type of programing language you know
1
Upvotes
3
u/TomatoCo Aug 16 '25
In one word: Misdirection. You write code that takes the abstract syntax tree of your nicely written code and mangles it. Four ideas off the top of my head, from weakest to strongest.
Remove every understandable variable name and whitespace.
Change every form of flow control into a manually managed while loop.
Put every function into a table and use some logic to decide which functions to call instead of just calling them in order.
More advanced obfuscators will even implement their own VM in Lua and transpile the Lua into their own language. Though this one can have significant performance impacts.
3
u/EvilBadMadRetarded Aug 16 '25
Inserting in bytecode level some
trap/dead codeto confuse some naive de-compiler. eg, <in bytecode>I don't know if there is existed lua de-compiler sophisticated enough to handle such tho.
-5
u/nawidkg Aug 16 '25
Why do you want to make a lua obfuscator? What’s even the purpose behind it, if you are selling scripts take a look at lura.ph crazy tld btw, but you can pay per use or have an subscription, anyways I have used their obfuscation before and it’s safe to say you can’t deobfuscate it