Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions filetype/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
archive.Z(),
archive.Lzop(),
archive.Lz(),
archive.Elf(),
archive.Lz4(),
)

Expand Down
21 changes: 21 additions & 0 deletions filetype/types/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,27 @@ def match(self, buf):
buf[3] == 0x50)


class Elf(Type):
"""
Implements the Elf archive type matcher
"""
MIME = 'application/x-executable'
EXTENSION = 'elf'

def __init__(self):
super(Elf, self).__init__(
mime=Elf.MIME,
extension=Elf.EXTENSION
)

def match(self, buf):
return (len(buf) > 52 and
buf[0] == 0x7F and
buf[1] == 0x45 and
buf[2] == 0x4C and
buf[3] == 0x46)


class Lz4(Type):
"""
Implements the Lz4 archive type matcher.
Expand Down