How can I make Lua scripts un-decompilable?

I have many Lua scripts (for the Multi Theft Auto multiplayer mod) that have been compiled for many reasons, including theft prevention. In fact, this is just a theft, as Luadec (http://luadec51.luaforge.net/) can easily decompile scripts. Does anyone have any advice on how I can make my scripts not decompile?

+5
source share
4 answers

Encryption; this is really the only way to work. Of course, since your program would need to decrypt them, they could just rip the decrypted data directly from memory.

So no, you can’t do anything. Any method will be to some extent "only a deterrent to theft." Even compiling to the actual build is just a deterrent, as it can be decompiled into something completely different from the source code.

The question is how many problems do you want to give the user. Encryption probably gives you the best chance for your dollar. This will force them to go through the executable to figure out how to wrest data from memory. Most regular users will not want to do this.

+6
source

If you want to work hard, you can change the operation codes generated and used by lua vm, then it could not be decompiled using the software on the shelf. Although this may cause you more problems than it costs, you will have to maintain your own version of lua, and you probably could not use things like luajit.

To decompile, they would have to define a mapping of the operation codes that you invented and translated. It probably would not be too difficult to do, but I probably would not.

[Refresh]

Looking at the source, it can be pretty easy, there are two files lopcode.c and lopcode.h, maybe if you just change the order of the operation codes in them, you will do it. Please write if you are done doing this and it works or not.

+2
source

Multi Theft Auto now supports script encryption. You can compile them online at http://luac.mtasa.com/ or download the standalone compiler.

+2
source

I do not think that's possible. The very nature of the beast (a very minimal language running on a very small VM) in principle prohibits it.

The best you can hope for is that the decompiled code is just as hard to understand as humanly possible.

+1
source

Source: https://habr.com/ru/post/903729/


All Articles