4

There is a command called file that can recognize multiple file types both by the headers and by the contents of the files (when they are plain text).

I would like to know if there is a way to alter a file just to its header. To make an mp3 file look like a RAR archive, for example, but letting the rest of the file intact.

So, when you want, you can change the header of the file back to MP3 and it will work as before.

Is this even possible with software available in Ubuntu or in general?

1 Answer 1

4

Yes, it is possible to alter a binary file with any hex editor. All you need to do is find the magic number and change it. An MP3 file will start with hex 49 44 33 (=ID3) or hex FF FB.

The magic number for a RAR file is hex 52 61 72 21 1A 07 00. If you need more see: http://www.garykessler.net/library/file_sigs.html

A good hex editor might be Bless.

1
  • 1
    Is there any programatic way, or command line way to do what is described here?
    – j0h
    May 2, 2018 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .