Open pombredanne opened 9 months ago
A simple way to go may be:
def is_macho(self):
return (
self.filetype_file.lower().startswith('mach-o')
or self.mimetype_file.lower().startswith("application/x-mach-binary")
)
or from a file location
def is_macho(location):
t = get_type(location)
return (
t.filetype_file.lower().startswith('mach-o')
or t.mimetype_file.lower().startswith("application/x-mach-binary")
)
A small truncated file is enough for testing:
For instance:
head -c 100 GoReSym_mac > bar
and bar is only 100 bytes.
See https://en.wikipedia.org/wiki/Mach-O
They have these characteristics:
we should have a basic detection to qualify these as binaries and executables.