-3

So I am working on a obfuscator where you place a script in a file called script.lua An I wan't to get every single local variable and change it and also change it everywhere where the variable was refrenced so for example

local Hello = "Hello World"

print(Hello)

Becomes

HDHASUoasdhfbdjs = "Hello World"

print(HDHASUoasdhfbdjs)

is this possible?

Nifim
  • 4,758
  • 2
  • 12
  • 31
Beemo
  • 41
  • 4
  • This maybe helpful reading, [How do I de-obfuscate a Lua script?](https://stackoverflow.com/questions/66121229/how-do-i-de-obfuscate-a-lua-script) – Nifim Jul 02 '21 at 13:44

1 Answers1

0

The simplest way would be to build an Abstract Syntax Tree (AST) of the code fragment you want to obfuscate (using tools like metalua), walk that tree and change all variable names to something else (keeping track of what is changed to what) and then convert the AST back to the source code (metalua provides methods to do that).

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56