[File] [E] Re: How to detect go mac executables with magic.h?
Matthew Czarnek
matthew.czarnek at verizonmedia.com
Tue May 25 22:25:59 UTC 2021
Hi Christos,
I'm using version 5.11-37.el7 of file, the latest version.
For the mac executable on Linux:
"file magic8" correctly shows:
magic8: Mach-O 64-bit executable
But "file -i magic8", which I believe uses the magic.h header shows:
magic8: application/octet-stream; charset=binary
Thanks,
Matt
On Tue, May 25, 2021 at 6:21 PM Christos Zoulas <christos at zoulas.com> wrote:
> 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
>
>
> 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/dc7304ab/attachment.htm>
More information about the File
mailing list