Skip to content

Instantly share code, notes, and snippets.

@picatz
Created May 7, 2018 18:03
Show Gist options
  • Save picatz/640c1f623baeedb94ed896cf4bd803e1 to your computer and use it in GitHub Desktop.
Save picatz/640c1f623baeedb94ed896cf4bd803e1 to your computer and use it in GitHub Desktop.
package main
import (
"debug/pe"
"fmt"
"gopkg.in/yaml.v2"
)
func main() {
f, err := pe.Open("sample.exe")
if err != nil {
panic(err)
}
defer f.Close()
for _, section := range f.Sections {
yaml, err := yaml.Marshal(section)
if err != nil {
panic(err)
}
fmt.Println("---") // YAML seperator
fmt.Println(string(yaml))
}
}
// $ pry
// >> require "yaml"
// >> stream = YAML.load_stream(`go run pe_sections_info_as_yaml.go`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment