Created
November 11, 2020 16:34
-
-
Save syohex/2a3d49bda13c2fd232d156bf6ba9ed74 to your computer and use it in GitHub Desktop.
Check Windows binary architecture in Golang
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" | |
"os" | |
) | |
func main() { | |
if len(os.Args) < 2 { | |
fmt.Println("Usage: win_exe_check exe_file") | |
return | |
} | |
file, err := pe.Open(os.Args[1]) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
// Print 8664 (x64), 14c(x86) | |
fmt.Printf("machine: %x\n", file.Machine) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment