diff --git a/main.go b/main.go index a7f80ad..b394bae 100644 --- a/main.go +++ b/main.go @@ -196,6 +196,7 @@ func process(request string) string { return "say \"status \" to see vital stats of " } + parts[2] = cleanHostname(parts[2]) address, user, keypath := getSshEntryOrDefault(parts[2]) client, err := sshConnect(user, address, keypath) if err != nil { diff --git a/sshhelper.go b/sshhelper.go index 39b5f86..f277882 100644 --- a/sshhelper.go +++ b/sshhelper.go @@ -39,6 +39,7 @@ import ( "net" "os" "os/signal" + "regexp" "strings" "syscall" ) @@ -141,6 +142,11 @@ func addKeyAuth(auths []ssh.AuthMethod, keypath string) []ssh.AuthMethod { } } +func cleanHostname(hostname string) string { + match := regexp.MustCompile(`\ 0 { if agconn, err := net.Dial("unix", sock); err == nil {