Repository navigation
Add opt-in encrypted pack key recovery (--recover-key) - #470
Closed
figurophobia wants to merge 1 commit into
Closed
figurophobia wants to merge 1 commit into
figurophobia wants to merge 1 commit into
Conversation
Scan the pack or self-contained executable for a 32 byte key that decrypts the directory table, verifying candidates against the index MD5. The scan only runs when --recover-key is passed, so the existing behaviour is unchanged unless the option is explicitly requested. Adds a small test that builds v2/v4 packs with an encrypted index and checks that the key is found (and that no key is reported when absent).
figurophobia
force-pushed
the
recover-key
branch
from
October 21, 2026 19:55
26a0602 to
6d0cc24
Compare
Collaborator
|
Sorry, but I am going to have to decline. I do not wish to escalate the obfuscation arms race. GDRE Tools is the most popular reverse-engineering tool for Godot games, and if this functionality is added, I fear that developers will start to add custom encryption and/or other obfuscation methods to prevent reverse-engineering their games. That would be a net-loss for everyone. I appreciate the effort put into this nonetheless, and I would suggest you make this a separate tool. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds an opt-in way to open packs whose directory table is encrypted when the key is not known:
--recover-keyscans the pack (or the self-contained executable that contains it) for the 32-byte key and verifies each candidate against the index MD5.I know key extraction was declined in #7, so this is deliberately narrow and does nothing unless the user explicitly passes the flag:
PACK_DIR_ENCRYPTEDis opened and no key was supplied.Implementation:
utility/key_recovery.cpp: parses the pack header (v2/v3/v4), locates the encrypted directory, and scans the containing file in parallel chunks withWorkerThreadPool. Candidates are cheaply filtered by decrypting the first 16 bytes and checking for a plausible path prefix (res://or a printable relative path), then fully verified by decrypting the table and comparing its MD5.GDREPackedSource::try_open_packcalls it whenGDRESettings::is_key_recovery_enabled()is set and no key is available. On success the key is stored like a user-provided key;set_encryption_keynow also syncs the engine's script encryption key so encrypted resources keep working.standalone/gdre_main.gd:--recover-keyflag and help text; README updated.tests/test_key_recovery.cpp: builds v2 and v4 packs with an encrypted index and checks the key is found, plus a negative case that must return nothing.Known limitations:
.pckwhose key only exists in a separate executable cannot recover it from that file alone; point the tool at the executable (or the game directory) instead.PACK_SPARSE_BUNDLE) use the salt-based scheme and are skipped.Locally I built the module against the
gdre-wb-f964fa714f5branch withtests=yesand the full[GDSDecomp]suite passes (100 cases, including the 3 new ones). CI here is waiting for workflow approval, so it hasn't run on GitHub yet.If the project's stance on this hasn't changed, feel free to close this; I mainly wanted to see whether an opt-in, CLI-only version would be acceptable.