Decrypt CookieCloud data using standard Python crypto Args: uuid: User UUID encrypted: Base64 encrypted data password: Password Returns: Decrypted data dictionary
(uuid: str, encrypted: str, password: str)
| 30 | |
| 31 | |
| 32 | def decrypt(uuid: str, encrypted: str, password: str) -> dict: |
| 33 | """ |
| 34 | Decrypt CookieCloud data using standard Python crypto |
| 35 | |
| 36 | Args: |
| 37 | uuid: User UUID |
| 38 | encrypted: Base64 encrypted data |
| 39 | password: Password |
| 40 | |
| 41 | Returns: |
| 42 | Decrypted data dictionary |
| 43 | """ |
| 44 | # 1. Generate key: first 16 characters of MD5(uuid + "-" + password) |
| 45 | key_input = f"{uuid}-{password}" |
| 46 | hash_result = hashlib.md5(key_input.encode('utf-8')).hexdigest() |
| 47 | key = hash_result[:16].encode('utf-8') |
| 48 | |
| 49 | # 2. Fixed IV: 16 bytes of zeros |
| 50 | iv = b'\x00' * 16 |
| 51 | |
| 52 | # 3. Decode base64 encrypted data |
| 53 | encrypted_data = base64.b64decode(encrypted) |
| 54 | |
| 55 | # 4. Create AES-128-CBC cipher |
| 56 | cipher = AES.new(key, AES.MODE_CBC, iv) |
| 57 | |
| 58 | # 5. Decrypt and remove padding |
| 59 | decrypted = cipher.decrypt(encrypted_data) |
| 60 | unpadded = unpad(decrypted, AES.block_size) |
| 61 | |
| 62 | # 6. Parse JSON |
| 63 | result = json.loads(unpadded.decode('utf-8')) |
| 64 | |
| 65 | return result |
| 66 | |
| 67 | |
| 68 | def print_cookies(cookie_data: dict): |