Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example Go file embedding multiple .NET executables
package main
Example Go program with multiple .NET Binaries embedded
This requires packr ( and the utility. Install with:
$ go get -u
Place all your EXEs are in a "binaries" folder
Run "packr build". The resulting Go binary will contain all the binaries embedded
import (
clr ""
var binaries packr.Box
func init() {
binaries = packr.NewBox("./binaries")
func showUsage() {
fmt.Printf("Usage:\n%s <binary> <args>\n", os.Args[0])
fmt.Println("\nPackaged Binaries:")
for _, binary := range binaries.List() {
fmt.Printf("\t%s\n", binary)
func main() {
if len(os.Args) == 1 {
binName := os.Args[1]
binArgs := os.Args[1:]
binBytes, err := binaries.Find(binName)
if err != nil {
fmt.Printf("[!] Error finding binary: %s\n", binName)
retCode, err := clr.ExecuteByteArray(TARGET_VERSION, binBytes, binArgs)
if err != nil {
fmt.Printf("[+] %s returned exit code: %d\n", binName, retCode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment