How do .rar utilities manage to decompress a hidden compressed file (which is actually binary content appended to another file)?

خرید بک لینک

After a puzzle in puzzles.SE which involved a hidden file appended to a gif, I have a question regarding appended .rar files.

By this question I understand why I can add a .rar file content at the end of any known image format, as long as such format declares their data length in some way that any compliant reader would load only the required amount of bytes, and not read until end of file.

I can generate such file like this:

$ cat myimg.jpg myhidden.rar > myimg.jpg

Which works for any of the mentioned formats and will happily open as a regular image in the image viewer.

What surprised me is that I can actually open the hidden file! This is:

$ sudo apt-get install unrar
$ unrar e myimg.jpg

and will extract the files inside the contents of myhidden.rar

And my question is: How is that possible? My first thought in the matter would be that when I try to open my file, the .rar header is not found at the top (instead, a strange format the rar... parser, should not recognize), but somehow the utility manages to find the actual rar file and open it. I noticed this works both in Ubuntu and in Windows with WinRAR.

What am I missing? Does this work with other formats as well? (concretely: .zip, .7z, .tar.gz).

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 184 تاريخ: جمعه 7 خرداد 1395 ساعت: 4:16

صفحه بندی