Created
March 9, 2017 23:54
-
-
Save qzaidi/d4c1df63c85005913ebeb7a5c4b13b42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"fmt" | |
"log" | |
"debug/elf" | |
) | |
func main() { | |
bin, err := os.OpenFile(os.Args[0],os.O_RDONLY,0) | |
if err != nil { | |
log.Fatalln("can't open file",err) | |
} | |
f,err := elf.NewFile(bin) | |
if err != nil { | |
log.Fatalln("elf read error",err) | |
} | |
if sect := f.Section(".gosymtab"); sect != nil { | |
fmt.Println("found a .gosymtab") | |
} | |
if sect := f.Section(".note.go.buildid"); sect != nil { | |
fmt.Println("found note", sect.Name, sect.Type) | |
if d,err := sect.Data(); err == nil { | |
fmt.Println(string(d[:])) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment