Is it possible to fix headers of a zip file in hex editor?

Viewed 366

I am a completely beginner in file structures or in this field.

I am trying to extract a .7z file, but it shows "Cannot open file_name.7z as an archive". So i researched and found that there is something wrong in headers after looking the file in hex editor which look like this(first 3 lines out of many lines): hex editor screenshot of my corrupted 7z file

After looking at other 7z files hex editor, i saw that there is data in first two lines unlike the above corrupted file. For example: hex editor screenshot of working 7z file for reference

I just want to know that can i get this corrupted or missing header fixed and extract file? or is there anyway to get data from this 7z file?

please help me with this information as these files are my backed up data and i dont have copy of them.

1 Answers

Assuming the header is the only part affected, you can use hexedit to replace the 37 7A BC AF with 50 4B 03 04.

  • 50 4B 03 04 means ASCII translation of PK
  • Backup the file before any modification

example:

00000000   50 4B 03 04  14 00 00 00  00 00 27 6F  C6 54 00 00  00 00 00 00  00 00 00 00  00 00 0A 00  20 00 47 6F  20 69 6D 61  67 65 73 2F  55 54 0D 00  07 0B 4E 9E  PK........'o.T.............. .Go images/UT....N.
00000030   62 0C 4E 9E  62 0C 4E 9E  62 75 78 0B  00 01 04 F6  01 00 00 04  14 00 00 00  50 4B 03 04  14 00 08 00  08 00 27 6F  C6 54 00 00  00 00 00 00  00 00 D2 00  b.N.b.N.bux.............PK........'o.T..........

Hexedit linux: https://linux.die.net/man/1/hexedit

Related