ssh: handshake failed: ssh: no common algorithm for key exchange; client offered: [[email protected] ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha1], server offered: [diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1] RunCommands result:
package main
import ( "fmt" "github.com/shenbowei/switch-ssh-go" )
func main() { user := "test" password := "QWX@123x" ipPort := "192.168.16.234:22"
//get the switch brand(vendor), include h3c,huawei and cisco brand, err := ssh.GetSSHBrand(user, password, ipPort) if err != nil { fmt.Println("GetSSHBrand err:\n", err.Error()) } fmt.Println("Device brand is:\n", brand) //run the cmds in the switch, and get the execution results cmds := make([]string, 0) cmds = append(cmds, "dis clock") cmds = append(cmds, "dis vlan") result, err := ssh.RunCommands(user, password, ipPort, cmds...) if err != nil { fmt.Println("RunCommands err:\n", err.Error()) } fmt.Println("RunCommands result:\n", result) }
