elf is a go package for parsing Executable and Linkable Format (ELF). This package is designed for static malware analysis and reverse engineering.
You can install the elf package and its dependencies using the go get command.
go get github.com/saferwall/elf
package main
import (
"encoding/json"
"fmt"
"github.com/saferwall/elf"
)
func main() {
p, err := elf.New("/bin/ls")
defer p.CloseFile()
if err != nil {
panic(err)
}
err = p.Parse()
if err != nil {
panic(err)
}
jsonFile, err := p.DumpJSON()
if err != nil {
panic(err)
}
fmt.Println(jsonFile)
}