golang ssh 包的时候思科设备可以 ssh 上去 华为不行 各位大佬指点一下 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
mangwen
V2EX    Go 编程语言

golang ssh 包的时候科设备可以 ssh 上去 华为不行 各位大佬指点一下

  •  
  •   mangwen 2019-11-01 17:23:02 +08:00 6869 次点击
    这是一个创建于 2175 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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) 

    }

    6 条回复    2019-12-11 10:03:34 +08:00
    leezii
        1
    leezii  
       2019-11-01 17:36:26 +08:00
    这不就是说算法不一致吗
    lc7029
        2
    lc7029  
       2019-11-01 17:40:16 +08:00
    你看看设备是不是用的 ssh1,而程序不支持 ssh1。
    有些较老的设备只支持 ssh1 且不支持 ssh2。
    heijiaotuan
        3
    heijiaotuan  
       2019-11-01 17:40:52 +08:00
    客户端支持的 ssh 算法也太少了吧
    reus
        4
    reus  
       2019-11-01 17:58:55 +08:00
    搜索 "golang diffie-hellman-group1-sha1"
    你会得到: https://github.com/golang/crypto/commit/36a967d3212260ed1abea70bb749e710e26457a

    搜索 "golang diffie-hellman-group-exchange-sha1"
    你会得到: https://github.com/golang/go/issues/17230

    问搜索引擎显然比问 V2EX 好。
    TOUJOURSER
        5
    TOUJOURSER  
       2019-12-09 14:46:39 +08:00
    请问这个问题解决了吗
    mangwen
        6
    mangwen  
    OP
       2019-12-11 10:03:34 +08:00
    @TOUJOURSER 没有 就是算法不一致 ,包不支持,换 python 操作交换机了 。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5573 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 29ms UTC 06:32 PVG 14:32 LAX 23:32 JFK 02:32
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86