0

As part of a program I am in, I have been given a zip file that won't open. I have worked out that the file header is missing from the zip, but I am not sure how to put it back. Simply replacing the first bytes or using programs that ignore the header to unzip doesn't work, so I think I need to put them before the rest of the file. This might require offsetting the file or something, but I don't know a lot about hex editing/hex editors, or how to do what I need to.

I'm using Manjaro (a vm provided by the program), and gHex to view and edit the files (though I can install different ones/work from the terminal if that will solve my problem).

Edit: Running zip -F or zip -FF returns:

Fix archive (-F) - assume mostly intact archive
Zip entry offsets appear off by -4 bytes - correcting...
copying: masterkey
zip warning: reading archive fseek: Invalid argument
zip warning: bad - skipping: masterkey
zip warning: zip file empty

The problem with the above is that I am almost certain that the zip file cannot be empty -- it should contain something that has a flag (attempting to extract the 'fixed' zip also returns 'Error extracting archive' from the archive manager).

  • what is the result of command file corrupted_archive? – Romeo Ninov Mar 8 at 19:27
  • "Zip archive data" – karot Mar 8 at 19:30
  • It could not be a tar. Please add the output of file xxx.zip to the question – Rui F Ribeiro Mar 9 at 8:12
1

You can try to recover the broken archive by executing command:

zip -F corrupted_archive.zip

Of you can make zip to try harder to recover via

zip -FF corrupted_archive.zip

For me this is much safer and better than try to edit directly the file

  • Updated original question to show results – karot Mar 8 at 19:39
  • @karot, seems like your zip file is seriously corrupted. And I have my doubts if any hand operation can help – Romeo Ninov Mar 8 at 19:48
  • Thanks for the help. It is possible that I cannot recover this file, though I don't see why the creators of the challenge will have made it so. I will continue to look for answers – karot Mar 8 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.