From the magic file format manual the format for the rule should be

offset type value message

For example:

0      string   MZ
>0x18  leshort  <0x40   MS-DOS executable
>0x18  leshort  >0x3f   extended PC executable (e.g., MS Windows)

Using this context, I am trying to understand magic file such as this one which has rules like

# DIY-Thermocam raw data
0   name    diy-thermocam-parser
>0  beshort x   scale %d-

What does the first rule mean? name is not a valid type from the man page at least. And there is no test component.


You're looking at a manpage that isn't for the version of software you're looking at

The manpage from the doc directory at that github site says:

          name        Define a ``named'' magic instance that can be called
                      from another use magic entry, like a subroutine
                      call.  Named instance direct magic offsets are rela-
                      tive to the offset of the previous matched entry,
                      but indirect offsets are relative to the beginning
                      of the file as usual.  Named magic entries always

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.