Created
May 7, 2018 18:03
-
-
Save picatz/640c1f623baeedb94ed896cf4bd803e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
"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