Created
January 17, 2026 00:32
-
-
Save Jeswang/eeac3eb0977dee490814926e74538c9a to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env python3 | |
| import hashlib | |
| import binascii | |
| import zlib | |
| import zipfile | |
| import sys | |
| import os | |
| from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | |
| from cryptography.hazmat.backends import default_backend | |
| STATIC_SALT_HEX = "da40cc64900b617a0f72ad4e6ef42f9c" | |
| def decrypt_gpif(encrypted_data, password): | |
| # Fixed salt from binary | |
| salt = binascii.unhexlify(STATIC_SALT_HEX) | |
| iterations = 4096 | |
| key_length = 32 | |
| # Derive key | |
| key = hashlib.pbkdf2_hmac("sha1", password.encode(), salt, iterations, key_length) | |
| if len(encrypted_data) < 16: | |
| return None | |
| iv = encrypted_data[:16] | |
| ciphertext = encrypted_data[16:] | |
| backend = default_backend() | |
| cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=backend) | |
| decryptor = cipher.decryptor() | |
| decrypted = decryptor.update(ciphertext) + decryptor.finalize() | |
| # Files are zlib compressed after encryption | |
| if decrypted.startswith(b'\x78'): | |
| try: | |
| return zlib.decompress(decrypted) | |
| except zlib.error: | |
| pass | |
| return decrypted | |
| def unlock_file(zip_path): | |
| print(f"Processing: {zip_path}") | |
| edit_locked_content = None | |
| encrypted_score = None | |
| # 1. Read necessary data | |
| try: | |
| with zipfile.ZipFile(zip_path, 'r') as z: | |
| if 'editLocked' in z.namelist(): | |
| edit_locked_content = z.read('editLocked').decode('utf-8') | |
| print(f"[+] Found editLocked: {edit_locked_content}") | |
| else: | |
| print("[-] No editLocked file found. Is it locked?") | |
| return False | |
| if 'Content/score.gpif' in z.namelist(): | |
| encrypted_score = z.read('Content/score.gpif') | |
| else: | |
| print("[-] No score.gpif found.") | |
| return False | |
| except Exception as e: | |
| print(f"[-] Error reading zip: {e}") | |
| return False | |
| # 2. Decrypt | |
| print("[*] Decrypting score...") | |
| # The "password" is the editLocked content string | |
| decrypted_score = decrypt_gpif(encrypted_score, edit_locked_content) | |
| if not decrypted_score or (b"<GPIF" not in decrypted_score[:200] and b"<?xml" not in decrypted_score[:200]): | |
| print("[-] Decryption failed. Key or logic incorrect.") | |
| return False | |
| print("[+] Decryption SUCCESS! Valid XML header found.") | |
| # 3. Create unlocked file | |
| output_path = os.path.splitext(zip_path)[0] + "_unlocked.gp" | |
| print(f"[*] Creating unlocked file: {output_path}") | |
| try: | |
| with zipfile.ZipFile(zip_path, 'r') as zin: | |
| with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zout: | |
| for item in zin.infolist(): | |
| # Skip lock file | |
| if item.filename == 'editLocked': | |
| continue | |
| # Replace score | |
| if item.filename == 'Content/score.gpif': | |
| zout.writestr('Content/score.gpif', decrypted_score) | |
| else: | |
| zout.writestr(item, zin.read(item.filename)) | |
| print(f"[+] Done! Unlocked file saved to: {output_path}") | |
| return True | |
| except Exception as e: | |
| print(f"[-] Error creating output zip: {e}") | |
| return False | |
| if __name__ == "__main__": | |
| if len(sys.argv) < 2: | |
| print("Usage: python3 unlock_score.py <file.gp>") | |
| sys.exit(1) | |
| unlock_file(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A possible error that someone may be seeing, ModuleNotFoundError: No module named 'cryptography', means that Python cannot find the specific library required to handle the AES decryption used in the script.
While Python comes with many built-in tools, the cryptography library is a third-party package that must be installed separately.
How to Fix It:
You need to use pip (Python's package installer) to download the missing module. Open your Command Prompt (CMD) or PowerShell and run the following command: pip install cryptography