Instantly share code, notes, and snippets.

@bertinatto /proc.go Secret
Last active Dec 27, 2017

Embed
What would you like to do?
package main
import (
"fmt"
"os"
"os/exec"
"time"
)
const (
self = "/proc/self/exe"
)
func main() {
l, err := os.Readlink(self)
if err != nil {
panic(err)
}
fmt.Printf("Path: %s\n", l)
time.Sleep(time.Duration(1 * time.Second))
fmt.Println("Starting new process")
c := exec.Cmd{
Path: self,
Stdout: os.Stdout,
Stderr: os.Stderr,
}
if err := c.Run(); err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment