Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DaveLak/61666ce2936d9c4a96d78fbac76a974a to your computer and use it in GitHub Desktop.
Save DaveLak/61666ce2936d9c4a96d78fbac76a974a to your computer and use it in GitHub Desktop.
#
# Created by @PhilippIRL
# Windows, non MS-Store version only (but if you change the file path it might work on other operating systems too)
#
# 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.
#
import os, sys
# path of offline.bnk on windows (non ms-store)
filePath = os.environ['LOCALAPPDATA'] + '\\Spotify\\offline.bnk'
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