Skip to content

Instantly share code, notes, and snippets.

@FaltoGH
Last active July 18, 2023 11:25
Show Gist options
  • Save FaltoGH/b7563b425e10de41c56bf7af0dc4c864 to your computer and use it in GitHub Desktop.
Save FaltoGH/b7563b425e10de41c56bf7af0dc4c864 to your computer and use it in GitHub Desktop.
CCLocalLevels.dat Decrypt
import base64, zlib, re
def decrypt(filename):
with open(filename, 'rb') as rbf:
dat = rbf.read()
a = [x^11 for x in dat]
b = bytearray(a).decode()
c = b.replace('-','+').replace('_','/')
d = c.encode()
e = base64.b64decode(d)
f = e[10:]
g = -zlib.MAX_WBITS
h = zlib.decompress(f, g)
i = h.decode()
return i
def decrypt2(levelcipher):
c = levelcipher.replace('-','+').replace('_','/')
d = c.encode()
e = base64.b64decode(d)
f = e[10:]
g = -zlib.MAX_WBITS
h = zlib.decompress(f, g)
i = h.decode()
return i
def decrypt3(filename):
xml = decrypt(filename)
levelcipher = re.findall('<k>k4</k><s>(.+)</s><k>k5</k>', xml)[0]
levelstring = decrypt2(levelcipher)
xml2 = xml.replace(levelcipher, levelstring)
return xml2
xml = decrypt3('CCLocalLevels.dat')
with open('a.txt', 'wt') as wtf:
wtf.write(xml)
@UnbihexiumFan
Copy link

Wait, do you have a way to encrypt the data?

@FaltoGH
Copy link
Author

FaltoGH commented Jul 18, 2023

idk but there will be a way in github or somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment