Created
June 28, 2021 09:27
-
-
Save darktohka/0320ea912bbe17d55c31df89fb9d8808 to your computer and use it in GitHub Desktop.
Decrypt s3bubble's static key video encryption
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
| # Decrypt s3bubble's static key video encryption | |
| # darktohka 2021 | |
| # python -m pip install pycryptodome | |
| # hlsdl.exe: https://rwijnsma.home.xs4all.nl/files/hlsdl/hlsdl-0.27-e9420c4-win32-static-xpmod-sse.7z | |
| from Crypto.Protocol.KDF import PBKDF2 | |
| from Crypto.Hash import SHA512 | |
| from Crypto.Cipher import AES | |
| from Crypto.Util.Padding import unpad | |
| import json, base64, binascii, subprocess | |
| # From: https://s3bubble.com/wp-admin/admin-ajax.php?action=s3bubble_proxy_token | |
| token = "eyJwYXNzcGhyYXNlIjoiNjBkOTg2YjE1NTc0ZCIsImNpcGhlcnRleHQiOiIxY2pFWkhzd1I4akVhZGhwMWlERDQ5Z042azJnMnJSbTFUT1dPbk1BTjZlbDJpZ21wVzEzTHlNclRhM1RoVDZuIiwiaXYiOiIyNGJmNzAyOTNiYjMyZTU4ZjA2ZWY1NWFmZTc1MjA3OSIsInNhbHQiOiIxNGRlYmE4NWE3NjlkY2JjOGRhNjQxODQ0Nzg2MzlkMSJ9" | |
| # From: network tab | |
| manifest = "https://d1wkjvw8nof1jc.cloudfront.net/c5146154-c4d7-4e2d-8e37-0ca8528a2278/master_Ott_Hls_Ts_Avc_Aac_16x9_640x360p_30Hz_600Kbps.m3u8" | |
| token = json.loads(base64.b64decode(token)) | |
| salt = binascii.unhexlify(token['salt']) | |
| iv = binascii.unhexlify(token['iv']) | |
| passphrase = token['passphrase'] | |
| ciphertext = base64.b64decode(token['ciphertext'].encode('utf-8')) | |
| n = PBKDF2(passphrase, salt, 32, count=999, hmac_hash_module=SHA512) | |
| aes = AES.new(n, AES.MODE_CBC, iv=iv) | |
| key = aes.decrypt(ciphertext) | |
| key = unpad(key, 16) | |
| key = key.decode('utf-8') | |
| print('Key:', key) | |
| # Make sure you have hlsdl.exe in the same directory | |
| subprocess.call(['hlsdl', '-K', key, manifest]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment