This commit is contained in:
Matt Burchett 2018-12-04 13:41:32 -06:00
parent 577a12d5c0
commit 00385479f4

View File

@ -33,11 +33,15 @@ func CreateShellAliases(data []string, username string, config config.Config) {
message := fmt.Sprintf("%vecho \"Authenticating as: %v\";%v", greentext, remoteUser, resettext)
// TXT Record Parsing
if strings.Contains(txt, "SSH_PORT") {
port := strings.TrimLeft(txt, "SSH_PORT=")
txtSplit := strings.Split(txt, ";")
for _, i := range txtSplit {
if strings.Contains(i, "SSH_PORT") {
port := strings.TrimLeft(i, "SSH_PORT=")
racOpts = fmt.Sprintf("ssh -AXt -p %v -l", port)
} else if strings.Contains(txt, "OS_FAMILY") {
osFamily := strings.Split(txt, "=")
} else if strings.Contains(i, "OS_FAMILY") {
osFamily := strings.Split(i, "=")
if osFamily[1] == "ESXi" {
sudo = ""
remoteUser = "root"
@ -50,6 +54,7 @@ func CreateShellAliases(data []string, username string, config config.Config) {
sudo = ""
}
}
}
fmt.Printf("alias %v=\\'%v%v%v %v@%v \"%v %v %v %v %v\"'\n", host, message, prerac, hop, username, jump, rac, racOpts, remoteUser, fqdn, sudo)
}