Broken/tampered Zip file
A friend of mine has sent me a zip file that they have tampered with/broke/corrupted. In this case, it is a Minecraft resource pack. I am unable to open the file at all, I have tried many many things to extract the contents. From many Windows tools and Linux tools. I know it is possible to extract it as you can load it into Minecraft and it works fully (and he has assured me it is possible)
Can you guys give me any assistance or guidance? I do not wish to be bested by him.
Here is a link to the zip file: https://www.mediafire.com/file/xcbg5ayrcawy8iv/pack.zip/file
Solution 1:
Zip archives have file information duplicated across two places: in separate metadata blocks right before each file's data, and in a "central directory" at the end. You can either read the archive from start to finish, processing files as you find them, or get the central list at the end and use its information to jump back to each file.
Most archiving tools use the central directory to list all files, because it's all in one place and therefore faster. The problem is that your archive doesn't have it.
However, it is still readable by Zip processing libraries that rely primarily on the per-file metadata blocks – if you have Python, then the zipfile
module will be able to read the archive contents. It will even allow you to extract the files using .extractall()
, though you will have to remove the "filename mismatch" consistency check from zipfile.py first.
The per-file metadata in this archive also has nonsensical information, such as bogus "original size" or "modification time". More importantly, the "CRC32" field is also wrong, so you will have to remove the "bad CRC" error report from the 'zipfile' module as well.