[File] How to detect go mac executables with magic.h?

Matthew Czarnek matthew.czarnek at verizonmedia.com
Tue May 25 21:52:26 UTC 2021


Hello,

I've been using this go library to detect file types to block our users
from uploading exes:
https://github.com/rakyll/magicmime

On a mac it is capable of using the magic.h header to detect the file type
of a go program compiled for mac as mime type "application/x-mach-binary",
on Linux however, it is not able to detect those executables, only
executables compiled for Linux. I'm guessing this is a matter of not having
this file type registered in the magic database/file containing all the
magic numbers?

This is the beginning of the file:

Ïúíþ^G^@^@^A^C^@^@^@^B^@^@^@^Q^@^@^@p^M^@^@<85>^@^@^@^@^@^@^@^Y^@^@^@H^@^@^@
__PAGEZERO

Is it possible to add this/fix this for my own version or the next release?

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20210525/66b0d2d8/attachment.htm>


More information about the File mailing list