From 57e3dbdffa505e36ad2d4beb3886ed83b9e13783 Mon Sep 17 00:00:00 2001 From: EncryptedKitten <34356359+EncryptedKitten@users.noreply.github.com> Date: Sat, 2 Jan 2021 22:34:22 -0600 Subject: [PATCH] Added a linktarget_raw and linktarget property to DepotFile, and added decryption of the linktarget to decrypt_filenames in DepotManifest. --- steam/core/manifest.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/steam/core/manifest.py b/steam/core/manifest.py index 7e3d213..8880de2 100644 --- a/steam/core/manifest.py +++ b/steam/core/manifest.py @@ -56,6 +56,22 @@ class DepotFile(object): :type: str """ return os.path.join(*self.filename_raw.split('\\')) + + @property + def linktarget_raw(self): + """Link target with null terminator and whitespaces removed + + :type: str + """ + return self.file_mapping.linktarget.rstrip('\x00 \n\t') + + @property + def linktarget(self): + """Link target matching the OS + + :type: str + """ + return os.path.join(*self.linktarget_raw.split('\\')) @property def size(self): @@ -177,13 +193,21 @@ class DepotManifest(object): for mapping in self.payload.mappings: filename = b64decode(mapping.filename) + if mapping.linktarget: + linktarget = b64decode(mapping.linktarget) + try: filename = symmetric_decrypt(filename, depot_key) + if mapping.linktarget: + linktarget = symmetric_decrypt(linktarget, depot_key) except Exception: raise RuntimeError("Unable to decrypt filename for depot manifest") mapping.filename = filename + if mapping.linktarget: + mapping.linktarget = linktarget + self.metadata.filenames_encrypted = False def deserialize(self, data):