-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c9c984c
Showing
32 changed files
with
4,649 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.* | ||
!.gitignore | ||
__pycache__ | ||
output | ||
logs | ||
test* | ||
//config.yaml |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<div align="center"> | ||
|
||
[](https://github.com/Eric-Joker/Enigmata) | ||
[](https://github.com/Eric-Joker/Enigmata/blob/main/LICENSE) | ||
 | ||
|
||
[🛠Install](#install) | | ||
[📖Usage](#usage) | | ||
[💡New insights](https://github.com/Eric-Joker/Enigmata/issues) | | ||
[💖Sponsor](#donation) | ||
|
||
[简体中文](./docs/README.zh-CN.md) | English | ||
|
||
</div> | ||
|
||
Due to the fact that resource packs developed by the community for Minecraft cannot be encrypted like those in the Marketplace, there will always be a few unethical individuals who steal the code from our hard-developed resource packs and publish it without attribution. | ||
|
||
**We do not want this script to be used too frequently, as it goes against the spirit of collaboration and sharing within the community. If you are willing to contribute to the community, please do not release only obfuscated resource packs.** | ||
|
||
# Enigmata | ||
|
||
> **Enigmata** is the Mythus Aeon from Honkai: Star Rail, it is a fallacy that all things can be experienced and recognized. | ||
Enigmata is an open-source resource pack obfuscator for Minecraft Bedrock Edition. It adds markers to files and obfuscates Json key values while ensuring the game can read them correctly. Currently, it has several features, such as: | ||
|
||
- Randomly permute and combine some visually similar characters to replace some JSON keys, values, and some file names. | ||
- Adding specific information to the tEXt of each PNG and to the id section of each TGA. | ||
- Merge JSON files in a folder. | ||
|
||
## Supported Resource Pack | ||
|
||
This obfuscator has some limitations regarding the resource packages it supports. Most of these limitations are not difficult to resolve, but since I do not need them. [Pull requests](https://github.com/Eric-Joker/Enigmata/pulls) are welcome. | ||
|
||
- NOT ADDON | ||
- The JsonUI obfuscation feature will only obfuscate controls in files that do not share the same name as Vanilla JsonUI files. eg: | ||
|
||
``` | ||
ui/ | ||
├── hud_screen.json | ||
├── inventory_screen.json | ||
└── namespace/ | ||
├── hud.json | ||
└── inventory.json | ||
``` | ||
It will only obfuscate the JsonUI in the `namespace`. If the JsonUI in the `ui` references controls from the former, the references will be obfuscated accordingly. | ||
- When using the filename obfuscation feature, the obfuscated images should preferably not be in the root directory of the resource pack, as this may lead to unexpected results. | ||
- When using the JsonUI and Entity series file merging features, files in subpacks are not merged. (The logic for excluding subpacks has not been tested.) | ||
- When using the merging feature for Entity series files, filenames must comply with the standards for /.+?\.(animation_controllers|animations|renderer_controllers|geo)\.json/. | ||
- and more? | ||
|
||
## Install | ||
|
||
Your device needs to have Python 3.12 or higher version installed. | ||
|
||
First, Download the source zip and unzip or using git to clone this repository: | ||
|
||
```sh | ||
git clone https://github.com/Eric-Joker/Enigmata.git | ||
cd Enigmata | ||
``` | ||
|
||
Next, use pip to install the dependencies: | ||
|
||
```sh | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## Usage | ||
|
||
Take a look at `config_example.yaml` for configuration, modify it and rename it to `config.yaml`. | ||
|
||
Then, try running the following: | ||
```sh | ||
python main.py | ||
``` | ||
|
||
All configurations in config.yaml have corresponding flags, which will take precedence over the config file. Use `-h` to see details. | ||
|
||
The obfuscated package will be output in the `./output`, where `obfuscation_reference.json` will list the corresponding strings before and after obfuscation." | ||
|
||
Under certain conditions, you may be required to update the Vanilla Data. You need to change the `vanillas_path` configuration to the directory containing all the Vanilla Resource Packs of the latest official version of the current game. Use `-e` to enter the data extraction process. | ||
|
||
## Donation | ||
|
||
Because I am still a minor, the policies in my area make it difficult for me to get money here. 😭 | ||
|
||
## Thanks | ||
|
||
Thanks to all the contributors of this project! | ||
|
||
Thanks for the help in finding more circle characters [TangTang](https://github.com/404). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
# 保存原版游戏数据的目录 | ||
data_path: './data' | ||
# 输出结果的路径 | ||
work_path: './output' | ||
vanillas_path: 'F:\.minecraft_bedrock\versions\f1d6a02f-046a-4907-a3d7-88a3b59c70d2\data\resource_packs' | ||
# 指定提取后的原版游戏资源包数据,为空字符串则尝试自动选择 | ||
# vanilla_data: | ||
|
||
log: | ||
file: false | ||
console: true | ||
path: './logs' | ||
|
||
packs: | ||
# 需要处理的资源包目录 | ||
# 若需使用 png 压缩功能,路径中请勿包含非 Ascll 字符 | ||
path: 'F:\.minecraft_bedrock\installations\Eric Joker\Latest Release\packageData\development_resource_packs\hsdzh' | ||
# 最终打包后的文件名,需与 path 一一对应 | ||
# 为空则不自动打包 | ||
zip_name: '红石大杂烩.mcpack' | ||
# 为混淆时提供独特的命名空间,需与 `path` 一一对应 | ||
namespace: rhp | ||
# 资源包目录下但不属于资源包的文件 | ||
excluded_files: | ||
- '.git/**' | ||
- '.git*' | ||
- '.mc*' | ||
- 'LICENSE' | ||
- 'README.md' | ||
# 修改 `manifest.json`, 这里的值均需与 `path` 一一对应,为False或空字符串或空列表则不进行修改 | ||
manifest: | ||
name: '§c红石§6大§e杂§a烩§bv§93§5.§d1§rCI' | ||
header_uuid: true | ||
header_version: true | ||
modules_uuid: true | ||
modules_version: true | ||
|
||
obfuscator: | ||
# 用于生成混淆后字符串的字符 | ||
obfuscate_strs: | ||
#- 'IlIl|' | ||
- '0Oo°Οο⁰₀○。〇︒0Oo' | ||
#- '0OoΟο○0Oo' | ||
|
||
# 用于生成生物系文件键值混淆后字符串的字符 | ||
# 必须全是 Ascll 字符 | ||
obfuscate_ascll: | ||
- 'abcdefghijklmn' | ||
|
||
json_funs: | ||
# 依据自然顺序排序 Json 键值 | ||
sort: true | ||
# 将 Json 键值中的字符串转为 Unicode,尽管是 Ascll 字符。遵循 `excluded_jsonui_names` 和 `excluded_entity_names` | ||
unicode: true | ||
# 在 json 结尾处添加无意义空字典“{}”,不影响游戏解析但可能会影响 IDE 解析 | ||
empty_dict: true | ||
# 去除 Json 格式化 | ||
unformat: true | ||
# 在 json 中添加以“:”分割混淆后的字符串的 CRC32 注释,不影响游戏解析但可能会影响 IDE 解析 | ||
comment: true | ||
# 合并 /ui/`namespace` 下的 json 为一个文件 | ||
merge_jsonui: | ||
enable: true | ||
# 合并后文件的路径 | ||
path: 'font/.test.png' | ||
# 在 `_ui_defs.json` 添加用于迷惑的键值 | ||
# 必须是 Json 字典字符串或空字符串 | ||
defs_confused: '{"test_assets_defs":[0]}' | ||
# 将 format_version 相同的模型、材质、动画、动画控制器、渲染控制器分别合并为一个文件 | ||
merge_entity: true | ||
# 混淆 JsonUI 中原版不具有的控件和非全局变量的变量、绑定、本地化键名 | ||
obfuscate_jsonui: true | ||
# 混淆原版不具有的生物、模型、粒子、材质、动画、动画控制器、渲染控制器的名字及其中变量名 | ||
obfuscate_entity: true | ||
# 不在 `(subpacks/*/)ui/` 文件夹下的 JsonUI 文件 | ||
additional_jsonui: | ||
# - | ||
|
||
file_funs: | ||
# 对 `paths` 中所有原版不具有的贴图文件的文件名添加由 `namespace` 随机分割的字符串 | ||
filename_watermark: | ||
enable: true | ||
paths: | ||
- '**/textures/blocks/**' | ||
- '**/textures/items/**' | ||
# 引用要打水印的文件的 json | ||
references: | ||
- '**/textures/item_texture.json' | ||
- '**/textures/terrain_texture.json' | ||
- '**/textures/flipbook_textures.json' | ||
# 将 `paths` 中所有原版不具有的贴图文件的文件名替换为由 `obfuscate_str` 随机生成的字符串 | ||
# 如果 `filename_watermark` 为 true,自动排除 `filename_watermark.paths` | ||
filename_obfuscation: | ||
enable: true | ||
paths: | ||
- '**/textures/ui/**' | ||
- '**/textures/number/**' | ||
- '**/textures/spawn_point/**' | ||
# 引用要打水印的文件的 json。 | ||
references: | ||
- '**/ui/**/*.json' | ||
- '**/entity/*.json' | ||
- '**/particles/*.json' | ||
- '!**/textures/**' | ||
# 将 `namespace` 添加进所有 png 的 tEXt、所有 tga 的 id section | ||
extrainfo: true | ||
# 所有 png 文件的压缩等级(0-9),默认为 6。 | ||
# >6 时启用 tga 文件压缩 | ||
# 为 -1 时允许程序跳过图片处理 | ||
# 等级越高文件越小、编码解码时间与性能需求越大,但好像并没有明显变化。 | ||
image_compress: 9 | ||
# 最终包体的压缩等级(0-9),默认为 -1还是6。 | ||
pack_compress: 9 | ||
# 打包时修改每个文件的 mtime,不能早于 1980 | ||
# 元素数不为 6 时不修改 | ||
mtime: | ||
- 1989 | ||
- 8 | ||
- 10 | ||
- 11 | ||
- 45 | ||
- 14 | ||
# 在资源包根目录下创建 `.nomedia` 文件 | ||
nomedia: true | ||
|
||
# 强制关闭 sort、unicode、empty_dict、unformat、comment | ||
debug: false | ||
|
||
# 不进行任何处理的 json | ||
excluded_jsons: | ||
- manifest.json | ||
- "**/loading_messages.json" | ||
- "**/blocks.json" | ||
- "**/item_texture.json" | ||
- "**/flipbook_textures.json" | ||
- "**/terrain_texture.json" | ||
- "**/sound_definitions.json" | ||
- "**/_global_variables.json" | ||
- "**/language_names.json" | ||
- "**/languages.json" | ||
- "**/splashes.json" | ||
|
||
# 不进行混淆、添加注释、转义、去格式化并且将顺序提前的 UI 一级控件、变量、绑定 | ||
excluded_jsonui_names: | ||
- hotbar_grid_template | ||
- setting_options_panel | ||
- chest_label_panel | ||
|
||
# 不在生物、模型、粒子、材质、动画、动画控制器、渲染控制器中进行混淆、转义、去格式化的键名和的 ID 及 Molang 变量名 | ||
excluded_entity_names: | ||
- number_0 | ||
- number_1 | ||
- number_2 | ||
- number_3 | ||
- number_4 | ||
- number_5 | ||
- number_6 | ||
- number_7 | ||
- number_8 | ||
- number_9 | ||
- divisor | ||
- bribed_sign | ||
- transforming | ||
- transparent | ||
- health_display_heart | ||
- target | ||
- target_tame | ||
- real_time_health_ten | ||
- max_health_ten | ||
- real_time_health_hundreds | ||
- max_health_hundreds | ||
- target_sign | ||
- transforming_sign | ||
- heart | ||
- real_time_health_single | ||
- max_health_single | ||
- max_health | ||
- health_display_offset | ||
- health_display | ||
- health_display_hide | ||
- health_display_baby | ||
- health_display_controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Enigmata, an obfuscator for Minecraft Bedrock Editon resource packs. | ||
# Copyright (C) 2024 github.com/Eric-Joker | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
from .base import cfg |
Oops, something went wrong.