multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.41k stars 435 forks source link

Make compiled scripts obfuscate names, line number and generate source map #3776

Open CrosRoad95 opened 1 week ago

CrosRoad95 commented 1 week ago

Is your feature request related to a problem? Please describe.

Even with strongest compilation method right now you can recover runtime informations of running lua scripts.

Describe the solution you'd like

As in title, Make compiled scripts obfuscate names, line number and generate source map

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

Fernando-A-Rocha commented 1 week ago

How?

shadylua commented 1 week ago

https://luarocks.org/modules/jirutka/luasrcdiet

Isn't Lua source code compression and renaming variable names for obfuscation? Is that exactly what you're talking about?

shadylua commented 1 week ago

In this context, it might be somewhat useful, but how often?

Standard Lua Code :

local function greet(name)
    local message = "hey, " .. name .. "!"
    print(message)
end

local name_p = "Shady"
greet(name_p)

Obfuscated Output with LuaSrcDiet :

local function a(a)
  local b="hey, "..a.."!"
  print(b)
end

local a="Shady"
a(a)
CrosRoad95 commented 1 week ago
function importantFunction()
    iprint("my name is:", debug.getinfo(1, "n").name, "at line", debug.getinfo(1).currentline)
end
importantFunction();

as you can see even i compiled script with "Even more (From 1.5.6-9.18728)", i still can get function name. There should be a checkbox "obfuscate symbols and line number" so script above will pint "my name is Kr at line 1", maybe with optional way to use comments to exclude parts of code from being obfscated therefore you can create an interface to compiled script.

image