Skip to content

Instantly share code, notes, and snippets.

@dmage
Created February 22, 2014 16:10
Show Gist options
  • Save dmage/9157272 to your computer and use it in GitHub Desktop.
Save dmage/9157272 to your computer and use it in GitHub Desktop.
code.google.com/p/go.crypto/ssh: unhandled message while creating NewSession
package main
import (
gossh "code.google.com/p/go.crypto/ssh"
"log"
)
type keyboardInteractive map[string]string
func (cr *keyboardInteractive) Challenge(user string, instruction string, questions []string, echos []bool) ([]string, error) {
var answers []string
for _, q := range questions {
answers = append(answers, (*cr)[q])
}
return answers, nil
}
func main() {
answers := keyboardInteractive(map[string]string{
"Password: ": "vagrant",
})
config := &gossh.ClientConfig{
User: "root",
Auth: []gossh.ClientAuth{
gossh.ClientAuthKeyboardInteractive(&answers),
},
}
c, err := gossh.Dial("tcp", "127.0.0.1:3499", config)
if err != nil {
log.Fatalf("unable to dial remote side: %s", err)
}
log.Println("opening new ssh session")
_, err = c.NewSession()
if err != nil {
log.Fatalf("ssh session open error: %s", err)
}
log.Println("done")
c.Close()
}
// 2014/02/22 19:55:19 opening new ssh session
// mainLoop: unhandled message *ssh.kexInitMsg: &{[123 127 9 29 48 2 135 210 65 202 160 32 85 5 119 142] [diffie-hellman-group-exchange-sha256 diffie-hellman-group-exchange-sha1 diffie-hellman-group14-sha1 diffie-hellman-group1-sha1] [ssh-rsa ssh-dss] [aes128-ctr aes192-ctr aes256-ctr arcfour256 arcfour128 aes128-gcm@openssh.com aes256-gcm@openssh.com aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc aes256-cbc arcfour rijndael-cbc@lysator.liu.se] [aes128-ctr aes192-ctr aes256-ctr arcfour256 arcfour128 aes128-gcm@openssh.com aes256-gcm@openssh.com aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc aes256-cbc arcfour rijndael-cbc@lysator.liu.se] [hmac-md5-etm@openssh.com hmac-sha1-etm@openssh.com umac-64-etm@openssh.com umac-128-etm@openssh.com hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com hmac-ripemd160-etm@openssh.com hmac-sha1-96-etm@openssh.com hmac-md5-96-etm@openssh.com hmac-md5 hmac-sha1 umac-64@openssh.com umac-128@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha1-96 hmac-md5-96] [hmac-md5-etm@openssh.com hmac-sha1-etm@openssh.com umac-64-etm@openssh.com umac-128-etm@openssh.com hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com hmac-ripemd160-etm@openssh.com hmac-sha1-96-etm@openssh.com hmac-md5-96-etm@openssh.com hmac-md5 hmac-sha1 umac-64@openssh.com umac-128@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha1-96 hmac-md5-96] [none zlib@openssh.com] [none zlib@openssh.com] [] [] false 0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment