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 [email protected] [email protected] aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc aes256-cbc arcfour [email protected]] [aes128-ctr aes192-ctr aes256-ctr arcfour256 arcfour128 [email protected] [email protected] aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc aes256-cbc arcfour [email protected]] [[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] hmac-md5 hmac-sha1 [email protected] [email protected] hmac-sha2-256 hmac-sha2-512 hmac-ripemd160 [email protected] hmac-sha1-96 hmac-md5-96] [[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] hmac-md5 hmac-sha1 [email protected] [email protected] hmac-sha2-256 hmac-sha2-512 hmac-ripemd160 [email protected] hmac-sha1-96 hmac-md5-96] [none [email protected]] [none [email protected]] [] [] false 0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment