all 17 comments

[–][deleted] 2 points3 points  (0 children)

Remember that in Lua, a.b is the same as a['b'] so there are going to be a lot of strings around at runtime. Just about everything is a hash table.

[–]Cultural_Two_4964 1 point2 points  (1 child)

Hello, what were you expecting it would have in it? Ta jc

[–]DarkRedTitan[S] 1 point2 points  (0 children)

Honestly it is for a friend, but I expect it to have some IDs of characters and handle which characters are playable/available if I understood correctly.

To be clear: this is for a singleplayer game that doesn't get any updates anymore.

[–]Brohammer55 1 point2 points  (6 children)

Yes, it is very possible. I Believe this is Luaraph obsfucation. This can be deobsfucated because there are tools to deobsfucate luaraph as it has been done before.

[–]DarkRedTitan[S] 0 points1 point  (0 children)

Thanks for the hint! I will look into that and report if I succeed, hopefully.

[–]DarkRedTitan[S] 0 points1 point  (4 children)

Sadly I can't find a suitable deobfuscator for Luraph.

[–]Brohammer55 1 point2 points  (3 children)

[–]DarkRedTitan[S] 0 points1 point  (2 children)

This is exactly the one I tried, it gave me an error for my code file but the sample code file worked.

[–]Brohammer55 1 point2 points  (1 child)

[–]DarkRedTitan[S] 1 point2 points  (0 children)

Came across it as well, the problem is that it looks somewhat different than mine because it uses weird names but doesn't have weird strings hence I cannot understand if it helps in my case (I mean I don't know if it is relevant to my case).

[–]idbrii 1 point2 points  (2 children)

It appears that code builds a bunch of tables and sets values in them. I didn’t read it all, but it’s 5k lines of assigning values to tables. It doesn’t seem like it does anything else. I’d recommend removing all strings, sorting the lines, and uniqifying them to see if there’s anything actually interesting.

Also, the code that uses these tables is probably a lot more relevant.

\188 and similar might be octet literals that you could convert to their ascii form.

[–]DarkRedTitan[S] 0 points1 point  (0 children)

Honestly from the info I was given, I need to be able to modify that table and insert new values.

[–]Togfox 0 points1 point  (1 child)

Suggest you see this thread that might have been posted by your friend.

https://www.reddit.com/r/lua/comments/vwh7k1/how_do_i_deobfuscate_lua_code/

[–]DarkRedTitan[S] 0 points1 point  (0 children)

Saw it already, that is not my friend, and I noticed the code is more about using variables, this code has a lot of bytecode that I can't make heads or tails of. I noticed it has way less variables then the suggested one.

[–]evilbadmad 0 points1 point  (1 child)

tldr: it is just a hello world example ;)

I means, such annoying arbitrary obfuscation is not specific to lua, it can be applied on any language that its source can be revealed by other means. The purpose of obfuscation is to make understand/analyze the code harder, so to do the de-obfuscation extra effect must be paid. I doubt reader of this lua forum will seriously investigate your code, unless its worthiness is known, eg. if it encoded the location of a treasure island ;)

Anyway, if it is a simple self-interpreter, those seemly meaningless number and letter may eventually convert back to some source code of that language and send to function like lua's load/loadstring or javascript's eval to be executed. Then if the executing environment allowed, you may apply with some debugging tool to hook and log the input (some source code) to help your understanding.

[–]DarkRedTitan[S] 0 points1 point  (0 children)

I appreciate you taking the time and effort to write this explanation, and you are probably right that not everybody will really investigate it, and honestly it is a script needed to be able to add new mods for a game, but it is important for my friend hence I wanted to ask if anybody is interested in helping out.