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

Christos Zoulas christos at zoulas.com
Tue May 25 22:21:06 UTC 2021


I don't know, it can be a number of things. What does the file(1) program say about it? What version of file(1) do you have installed on linux?

christos

> On May 25, 2021, at 5:52 PM, Matthew Czarnek <matthew.czarnek at verizonmedia.com> wrote:
> 
> Hello,
> 
> 
> 
> I've been using this go library to detect file types to block our users from uploading exes:
> https://github.com/rakyll/magicmime <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
> 
> 
> --
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20210525/fc474d96/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20210525/fc474d96/attachment.asc>


More information about the File mailing list