Last active
February 26, 2025 23:08
-
-
Save FelixWolf/fda516b1b628084899f38d881485a606 to your computer and use it in GitHub Desktop.
π Sink your social credit in one easy step! ππ²
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 | |
from Crypto.Cipher import AES | |
from Crypto.Util.Padding import unpad | |
import gzip | |
STEAMCHINA_ENCRYPTION_KEY = bytes([ | |
0x06, 0x89, 0x2a, 0x9c, 0x7d, 0x9b, 0xc6, 0x98, | |
0xc0, 0xf9, 0x03, 0x36, 0x0e, 0x3c, 0x22, 0x88, | |
0xba, 0x3d, 0xe4, 0x0f, 0xf7, 0x11, 0x01, 0xc2, | |
0x04, 0xb5, 0x20, 0xbe, 0x22, 0xc2, 0xad, 0xa4 | |
]) | |
def decrypt_aes_ecb(encrypted_iv, key): | |
cipher = AES.new(key, AES.MODE_ECB) | |
return cipher.decrypt(encrypted_iv) | |
def decrypt_aes_cbc(encrypted_data, key, iv): | |
cipher = AES.new(key, AES.MODE_CBC, iv) | |
return unpad(cipher.decrypt(encrypted_data), AES.block_size) | |
with open("filter_legal_legalcn.txt.gz", "rb") as f: | |
encrypted_data = gzip.decompress(f.read()) | |
# First 16 bytes is AES-ECB encrypted IV | |
decrypted_iv = decrypt_aes_ecb(encrypted_data[:16], STEAMCHINA_ENCRYPTION_KEY) | |
# Remaining bytes is AES-CBC encrypted data | |
decrypted_data = decrypt_aes_cbc(encrypted_data[16:], STEAMCHINA_ENCRYPTION_KEY, decrypted_iv) | |
if decrypted_data: | |
with open("filter_legal_legalcn.txt", "wb") as f: | |
f.write(decrypted_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment