Skip to content

Commit

Permalink
Add Elf file as supported matcher archive type
Browse files Browse the repository at this point in the history
  • Loading branch information
elemeat committed Aug 1, 2017
1 parent 32ffe49 commit 6fd9a2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func main() {
- **Z** - `application/x-compress`
- **lz** - `application/x-lzip`
- **rpm** - `application/x-rpm`
- **elf** - `application/x-executable`

#### Font

Expand Down
8 changes: 8 additions & 0 deletions matchers/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
TypeZ = newType("Z", "application/x-compress")
TypeLz = newType("lz", "application/x-lzip")
TypeRpm = newType("rpm", "application/x-rpm")
TypeElf = newType("elf", "application/x-executable")
)

var Archive = Map{
Expand All @@ -50,6 +51,7 @@ var Archive = Map{
TypeZ: Z,
TypeLz: Lz,
TypeRpm: Rpm,
TypeElf: Elf,
}

func Epub(buf []byte) bool {
Expand Down Expand Up @@ -207,3 +209,9 @@ func Rpm(buf []byte) bool {
buf[0] == 0xED && buf[1] == 0xAB &&
buf[2] == 0xEE && buf[3] == 0xDB
}

func Elf(buf []byte) bool {
return len(buf) > 52 &&
buf[0] == 0x7F && buf[1] == 0x45 &&
buf[2] == 0x4C && buf[3] == 0x46
}

0 comments on commit 6fd9a2b

Please sign in to comment.