package main import ( "io/ioutil" "os" "os/exec" "strconv" "syscall" "unsafe" ) func main() { newFdName := "test_fd" fdName, err := syscall.BytePtrFromString(newFdName) if err != nil { panic(err) } fd, _, _ := syscall.Syscall(319, uintptr(unsafe.Pointer(fdName)), 1, 0) pid := os.Getpid() file, err := ioutil.ReadFile("/home/capnspacehook/test.bin") if err != nil { panic(err) } fdPath := "/proc/" + strconv.Itoa(pid) + "/fd/" + strconv.Itoa(int(fd)) err = ioutil.WriteFile(fdPath, file, 0755) if err != nil { panic(err) } println(fdPath) fdCmd := exec.Command(fdPath) fdCmd.Stdout = os.Stdout fdCmd.Stderr = os.Stderr err = fdCmd.Run() if err != nil { panic(err) } }