-
-
Save Coldblackice/208354b301b5c960d0b6a23182995f28 to your computer and use it in GitHub Desktop.
This file contains 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
# Created by @PhilippIRL | |
# This script patches Spotify's offline.bnk file (this file caches the remote config) to trick Spotify into thinking that your account is enabled for dev tools. | |
# Spotify will automatically revert this local change after some time when it next fetches the remote config. | |
# Of course you will have to completely close Spotify before running this script. | |
import os, sys, platform | |
systemPlatform = platform.system() | |
if systemPlatform == 'Windows': | |
filePath = os.environ['LOCALAPPDATA'] + '\\Spotify\\offline.bnk' | |
elif systemPlatform == 'Darwin': | |
filePath = os.environ['HOME'] + '/Library/Application Support/Spotify/PersistentCache/offline.bnk' | |
elif systemPlatform == 'Linux': | |
homePath = os.environ['HOME'] | |
snapSpotifyHome = os.environ['HOME'] + '/snap/spotify/common' | |
if os.path.exists(snapSpotifyHome): | |
homePath = snapSpotifyHome | |
filePath = homePath + '/.cache/spotify/offline.bnk' | |
else: | |
print('Sorry, your platform is not yet supported.') | |
sys.exit(1) | |
# check if spotify is installed | |
if not os.path.exists(filePath): | |
print('It seems like you don\'t have Spotify installed.') | |
sys.exit(1) | |
file = open(filePath, 'r+b') | |
content = file.read() | |
# find last occurence of string 'app-developer' | |
loc = content.rindex(b'app-developer') | |
# 15 bytes after this string is the location we want to patch | |
patchLoc = loc + 15 | |
# only patch if the value is what we expect | |
if not (content[patchLoc] == 48 or content[patchLoc] == 50): | |
print('Unexpected value', content[patchLoc]) | |
sys.exit(1) | |
file.seek(patchLoc) | |
# change one byte to 50 (ascii '2') | |
file.write(bytes([50])) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment