Don't Starve Together

Don't Starve Together

92 ratings
Lua Decode Kits
3
2
3
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.347 MB
8 Dec, 2021 @ 1:37am
8 Dec, 2021 @ 3:59am
3 Change Notes ( view )

Subscribe to download
Lua Decode Kits

Description
lua decoding toolkit

thanks to @Vyuri for English (Google) translation

Notice! This is not a mod in itself! ! !
Notice! This is not a mod in itself! ! !
Notice! This is not a mod in itself! ! !

If you are learning how to make mods and want to refer to mods written by others, but find that they are all garbled, then this article is for you.

In recent years, individual authors have referred to the labor results in the open source community for creation, but are reluctant to share their own codes for various reasons, so they have used various encodings and pseudo-encryptions to prevent others from reading and learning. This behavior violates the original open source spirit of the community, spoils the atmosphere, and prevents players who are passionate about creating mods from learning, and seriously hinders the injection of fresh blood in the mod community.
(Of course, it is recommended to read the official code directly for learning to make mods. There are also many people on github that have compiled the documents of the official library, which is very convenient.)
In order to deal with some simple coding or so-called encryption measures, some coding cases and solutions are provided here.

It is recommended that the tool [Visual Studio Code] is used to process code and highlight code. If the code is not coded, but is formatted into a single line, you can use VSCode's lua format plug-in to format it into a standard format for reading

1. Escape the string type



feature:
There are a lot of strings of "\" plus three digits in the file, which essentially just encode the readable string into escape characters

solution:
Open 1.lua-string-decoder/lua-string-decoder.html in the mod folder, load the lua file that needs to be decoded, it will automatically decode and download the formatted plaintext file

2.loadstring type



feature:

There are a lot of strings with "\" plus 2-3 digits in the file, but the difference from the first is that there is a loadstring function before the string

solution:

This is actually using the first method to treat all codes as string type encoding, and then call Lua's loadstring method to load the string into code
A more convenient way is
(1). Change loadstring("code") to print("code") and copy this part to a new lua file, execute it in the lua environment, and output it to file 2.
For example, create a new file in the 2.lua5.1 for-loadstring-decode folder, such as code.lua, copy the print("code") above and save
(Assuming you are a windows system)
(2). Then in the 2.lua5.1 for-loadstring-decode folder, press and hold shift+right-click, and choose to open the PowerShell window here in the menu, and enter

.\lua5.1 code.lua> decode.lua

implement
(3). Then the code in decode.lua generated in the directory is the original code.

Precautions

Pay attention to whether the output file encoding is utf-8, sometimes the output file is utf-16, when saving and using, the file must be saved with utf-8 encoding before it can be used.
Some people use loadstring to recursively encode several times. For example, the decoded code is still loadstring. In this case, the above operation can be repeated several times. If there are many recursions, it is recommended to write a script to automatically execute until some normal code appears. Common non-escaped strings in, such as "function" and the like.


3.luac precompiled type

[/img
Feature: The file ends with .lua but opens a binary file. After opening with vscode, there are a lot of unreadable symbols in the text, but you can see LuaR or LuaQ readable text at the beginning of the file

solution:

This is pre-compiled with Luac, which can speed up the efficiency of executing Lua code and prevent the file from being read.
According to LuaR or LuaQ, the version of lua can be judged. R and Q represent the hexadecimal numbers 0x51 and 0x52, which are lua5.1 and lua5.2 versions.
The decompiler unluac.jar of lua5.1 version is provided by default in the mod file. If it is another version, you need to find the unluac warehouse in modinfo to download it or search for other versions of luac decompiler tools in github
Take the lua5.1 version as an example:
(1) Open the 2.lua5.1 for-loadstring-decode folder in the mod folder, and copy the lua script that needs to be decompiled, such as 1.lua
(2) Similarly shift+right click here to open the PowerShell window and enter java -jar unluac.jar --1.lua> 2.lua
(3) 2.lua is the decompiled file, but the variable name inside will mostly lose the original name due to compilation, so you need to identify the functions of each class and function by yourself


4. Function name substitution type



feature:

Functions and strings themselves are not encoded, but a large number of variable names and functions have been replaced with hard-to-read forms such as
function i1ll11lli11lii = xxx
illl11lliiilliiooii11li = true or something

solution:

Directly use the replace function of the editor to first replace the difficult-to-read characters in the file with shorter characters such as uppercase A B C,
Then analyze their purpose according to the code content and change the name yourself. If it is troublesome, you can write a script to automatically replace it.

Conclusion

The above are just solutions to the common encoding methods. In many cases, authors will use multiple coding methods in combination.



Popular Discussions View All (1)
1
8 Dec, 2021 @ 10:57pm
English (Google) translation
Vyuri
65 Comments
Saber Athena 19 Oct, 2023 @ 8:13am 
老哥秀的,你的这波操作对某些人来说怕不是核武:lunar2019laughingpig:
Mon-ius 19 Dec, 2022 @ 10:32am 
你确定DST能导入luac?
Harder_天使的花园 9 Aug, 2022 @ 7:33am 
相对于用Lua5.1开发的Forts来说,饥荒的圈子大多了
Harder_天使的花园 9 Aug, 2022 @ 7:24am 
Lua5.1的预编译解开后变量名没了,哎
Neil  [author] 4 Jan, 2022 @ 2:47am 
@LightningReturns 我倒是觉得是某个小丑开小号故意恶心大家罢了,那些mod本来都是开源的,不需要用到我的工具。不如你去关注一下谁在开服务器捞钱吧。
朱棣 1 Jan, 2022 @ 7:57am 
看到那个吾爱橙汁利用你的解码工具疯狂跳脸,我就觉得这是非常恶心的产物
zhenaixue 25 Dec, 2021 @ 7:31am 
说话,解密工具有源码咩?
Temporary Solutions 17 Dec, 2021 @ 9:24pm 
If you decode something and parts of it are still encoded, print all of your outputted code


如果代码的某些部分仍然加密,则打印所有输出
反峰黄浦江 17 Dec, 2021 @ 4:41am 
:steamhappy:
琥珀风声 15 Dec, 2021 @ 11:17pm 
大佬你为社区开源做贡献我觉得对整个饥荒社区都是很有帮助的。但是如果你说没有mod这游戏就凉了实在是大可不必。