I have a base64 encoded zip file. I am able to convert that zip file and then extract its content using Windows commandline. I have been trying to do the same with Python, but unsuccessful. Could you please help me? When I run the following code:
import base64
import codecs
import zlib
import io, zipfile, json, pprint
d = open("data.txt", "rb").read()
#dd = base64.decodestring(d)
#print(dd)
z = zipfile.ZipFile(io.BytesIO(d))
unpack = zlib.decompress(d)
I get the following error:
raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file
The data.txt file contains the base64 string: