Skip to content

Instantly share code, notes, and snippets.

@z3oc
Created December 26, 2017 04:21
Show Gist options
  • Save z3oc/897aeb816882405b837f434cf10a179d to your computer and use it in GitHub Desktop.
Save z3oc/897aeb816882405b837f434cf10a179d to your computer and use it in GitHub Desktop.
Convert cache from .uc! to .mp3 @ music.163.com
'''
Description: convert cache from music.163.com to mp3
Usage: python3 crackmusic163.py sourcefile [...]
Output: cache files converted to mp3 in current directory
'''
def crack163Cache(srcfile):
dstfile = srcfile.rstrip('uc!') + 'mp3'
with open(srcfile, 'rb') as f1, open(dstfile,'xb') as f2:
data = bytearray(f1.read())
for i in range(len(data)):
data[i] = data[i] ^ 163
f2.write(data)
print("Output:", dstfile)
if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
print('Usage: python3', sys.argv[0], 'sourcefile')
sys.exit()
for file in sys.argv[1:]:
if file.endswith('.uc!'): crack163Cache(file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment