Decompile Lua Files?

Programming related discussions related to game research
Cuber456
Posts: 9
Joined: Fri Dec 26, 2014 4:46 am

Decompile Lua Files?

Post by Cuber456 »

Yet another continuation of a thread I started for VLR. I've got some Lua files from the game. I'm interested in trying to decompile them back into source code. I know that decompiling is often a tricky thing but there do exist decompilers for Lua such as unluac. The problem is that these programs error out for some reason (I don't know why).

Here are two sample Lua files

How difficult is the process of bringing a Lua script back to source code? Are there any resources available to help guide me?

Thanks
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: Decompile Lua Files?

Post by makc_ar »

Please, help
Somebody can compile tool http://luajit.org/download.html?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Decompile Lua Files?

Post by aluigi »

Attached.
atom0s
Posts: 250
Joined: Sat Dec 27, 2014 8:49 pm

Re: Decompile Lua Files?

Post by atom0s »

Cuber456 wrote:Yet another continuation of a thread I started for VLR. I've got some Lua files from the game. I'm interested in trying to decompile them back into source code. I know that decompiling is often a tricky thing but there do exist decompilers for Lua such as unluac. The problem is that these programs error out for some reason (I don't know why).

Here are two sample Lua files

How difficult is the process of bringing a Lua script back to source code? Are there any resources available to help guide me?

Thanks


LuaDec exists for this purpose however it is kind of limited to what it can/can't restore. If the version of Lua that the application is using does not match the version that LuaDec was compiled with, it wont work. Also, if the Lua library the target uses has custom libraries, alterations or any new byte code added, LuaDec will fail due to it missing the custom things.

These two files do not work with the standard Lua library and LuaDec so it appears they have custom edits in their stuff.

The file header tells you what version of Lua is being used though to help limit things down:
Image

The beginning 1B 4C 75 61 is the typical Lua compiled file header. Afterward the 51 is the version.
This states that Lua 5.1 was used to compile the Lua chunk.
makc_ar
Posts: 1193
Joined: Sun Aug 17, 2014 7:27 pm

Re: Decompile Lua Files?

Post by makc_ar »

aluigi wrote:Attached.

Thanks aluigi

Library jit/*.dll?
Image
Cuber456
Posts: 9
Joined: Fri Dec 26, 2014 4:46 am

Re: Decompile Lua Files?

Post by Cuber456 »

atom0s wrote:LuaDec exists for this purpose however it is kind of limited to what it can/can't restore. If the version of Lua that the application is using does not match the version that LuaDec was compiled with, it wont work. Also, if the Lua library the target uses has custom libraries, alterations or any new byte code added, LuaDec will fail due to it missing the custom things.

These two files do not work with the standard Lua library and LuaDec so it appears they have custom edits in their stuff.

The file header tells you what version of Lua is being used though to help limit things down:
Image

The beginning 1B 4C 75 61 is the typical Lua compiled file header. Afterward the 51 is the version.
This states that Lua 5.1 was used to compile the Lua chunk.

Makes perfect sense. I guess I'm not surprised that they can't be decompiled with the standard library. I also guess it is safe to say that we don't know what libraries or custom things were used at compile time either. Looks like manual RE would have to be used to figure out what these files really do which is something not yet within grasp.

Also, really interesting to know that these two files were compiled with Lua 5.1. I did not know the LUA header contained that information.

Thank You.
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: Decompile Lua Files?

Post by bugmenot »

Lua decompilation is now available online at http://decompiler.com/
k117
Posts: 1
Joined: Sun Jan 30, 2022 12:19 pm

Re: Decompile Lua Files?

Post by k117 »

i need more help
i cant find main in code
thx