Example #1
0
	def process_chunk(chunk, depot_key):
		decrypted_chunk = CryptoUtil.symmetric_decrypt(chunk, depot_key)
		if decrypted_chunk[:2] == 'VZ':
			filter = lzma._decode_filter_properties(lzma.FILTER_LZMA1, decrypted_chunk[7:12])
			lzmadec = lzma.LZMADecompressor(lzma.FORMAT_RAW, None, [filter])
			return lzmadec.decompress(decrypted_chunk[12:len(decrypted_chunk)-10])
		else:
			zip_buffer = StringIO.StringIO(decrypted_chunk)
			with zipfile.ZipFile(zip_buffer, 'r') as zip:
				return zip.read(zip.namelist()[0])
Example #2
0
	def process_chunk(chunk, depot_key):
		decrypted_chunk = CryptoUtil.symmetric_decrypt(chunk, depot_key)
		if decrypted_chunk[:2] == 'VZ':
			filter = lzma._decode_filter_properties(lzma.FILTER_LZMA1, decrypted_chunk[7:12])
			lzmadec = lzma.LZMADecompressor(lzma.FORMAT_RAW, None, [filter])
			return lzmadec.decompress(decrypted_chunk[12:len(decrypted_chunk)-10])
		else:
			zip_buffer = StringIO.StringIO(decrypted_chunk)
			with zipfile.ZipFile(zip_buffer, 'r') as zip:
				return zip.read(zip.namelist()[0])
	def decrypt_filenames(self, depot_key):
		if not self.metadata.filenames_encrypted:
			return True
			
		for mapping in self.payload.mappings:
			filename = base64.b64decode(mapping.filename)
			
			try:
				filename = CryptoUtil.symmetric_decrypt(filename, depot_key)
			except Exception:
				print("Unable to decrypt filename for depot manifest")
				return False
			
			mapping.filename = filename.rstrip(' \t\r\n\0')

		self.metadata.filenames_encrypted = False
		return True
 def process_incoming(self, data):
     return CryptoUtil.symmetric_decrypt(data, self.key)
Example #5
0
 def process_incoming(self, data):
     return CryptoUtil.symmetric_decrypt(data, self.key)