shanghai-edu / multissh Goto Github PK
View Code? Open in Web Editor NEWmultissh
License: Apache License 2.0
multissh
License: Apache License 2.0
@freedomkk-qfeng 在修复 #20 的过程中,我有一些新的想法:
目前的测试把 ip 和端口硬编码在开源代码中,是一种不太安全的实践。理论上应该由用户手动填写一个本地数据文件。
还有我通过阅读 ssh.go 这个包的源码发现,google 内部的单元测试是编写了一个模拟 ssh server 的对象来测试的。我觉得也可以借用这种**去设计更好的测试流程。
关于真机测试,还可以采用 ssh -T [email protected]
这种方式来验证远程连接的有效性,因为大多数人从GitHub克隆项目一般都已经配置了GitHub上的公钥。参考: https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection
cmdfile文件里可以使用变量吗?比如获取当前连接的IP地址。
现在执行命令失败只能返回错误代码,无法看到失败的提示信息,希望能够获取执行命令失败的报错信息,而不仅仅返回错误代码
That's why retrun “SSH run timeout:30 second.”?
./multissh -cmds "cd /home;ls;exit" -hosts "192.168.182.65" -u root -p clouds
2019/06/27 20:32:56 Multissh start
2019/06/27 20:33:26 Multissh finished. Process time 30.000306562s. Number of active ip is 1
host: 192.168.182.65
========= Result =========
SSH run timeout:30 second.
ping is ok.
ping 192.168.182.65
PING 192.168.182.65 (192.168.182.65) 56(84) bytes of data.
64 bytes from 192.168.182.65: icmp_seq=1 ttl=64 time=0.111 ms
64 bytes from 192.168.182.65: icmp_seq=2 ttl=64 time=0.127 ms
64 bytes from 192.168.182.65: icmp_seq=3 ttl=64 time=0.083 ms
ssh [email protected] is ok.
what's wrong with me And what can I do?
你好,multissh不适用已经添加了公钥的机器。公钥免密登录的场景会更多。可否不加 -p或者 -k 默认走公钥登录呢?
具体情况跟上述连接。
原因是icx交换机配置了RADIUS authentication的话,输入enable后会要求输入帐号和密码,但是使用multissh失败
multissh.exe -hosts xxx.xxx.xxx.xxx -u username -p password -cmds "enable;username;password;show run"
2021/09/10 12:01:59 Multissh start
2021/09/10 12:02:30 Multissh finished. Process time 30.2485087s. Number of active ip is 1
host: xxx.xxx.xxx.xxx
========= Result =========
SSH run timeout:30 second.
虽然不知你有没有条件调试,但还是希望能修正multissh,由衷感谢。
我使用windows版本的multissh
multissh.exe -hosts xxx.xxx.xxx.xxx -u username -p password -cmds "terminal length 0;show environment"
2021/09/10 12:01:59 Multissh start
2021/09/10 12:02:30 Multissh finished. Process time 30.2485087s. Number of active ip is 1
host: xxx.xxx.xxx.xxx
========= Result =========
SSH run timeout:30 second.
如下是putty正常ssh执行
`VSS#show environment
Executing the command on VSS member switch role = VSS Active, id = 1
no temperature alarms
Module Sensor Temperature Status
------+--------------------------+--------------------+------------
1 Air inlet 21C (50C,66C,72C) ok
1 Air outlet 37C (73C,80C,92C) ok
1 XPP 67C (101C,120C,123C) ok
1 IFE 35C (65C,90C,120C) ok
1 CONAN 38C (67C,82C,100C) ok
1 CPU 36C (69C,102C,105C) ok
2 Air inlet 22C (56C,68C,71C) ok
2 Air inlet remote 20C (46C,59C,62C) ok
2 Air outlet 25C (66C,76C,79C) ok
2 Air outlet remote 25C (60C,71C,74C) ok
3 Air inlet 22C (56C,68C,71C) ok
3 Air inlet remote 20C (46C,59C,62C) ok
3 Air outlet 25C (66C,76C,79C) ok
3 Air outlet remote 25C (60C,71C,74C) ok
Power Fan Inline
Supply Model No Type Status Sensor Status
PS1 PWR-C45-2800AC AC 2800W good good good
PS2 PWR-C45-2800AC AC 2800W good good good
Power supplies needed by system : 1
Power supplies currently available : 2
Chassis Type : WS-C4506-E
Power consumed by backplane : 0 Watts
Switch Bandwidth Utilization : 0%
Supervisor Led Color : Green
Module 1 Status Led Color : Green
Module 2 Status Led Color : Green PoE Led Color : Green
Module 3 Status Led Color : Green PoE Led Color : Green
Beacon Led Status : off
Fantray : Good
Fantray removal timeout : 240
Power consumed by Fantray : 120 Watts
Executing the command on VSS member switch role = VSS Standby, id = 2
no temperature alarms
Module Sensor Temperature Status
------+--------------------------+--------------------+------------
11 Air inlet 23C (50C,66C,72C) ok
11 Air outlet 40C (73C,80C,92C) ok
11 XPP 69C (101C,120C,123C) ok
11 IFE 35C (65C,90C,120C) ok
11 CONAN 41C (67C,82C,100C) ok
11 CPU 39C (69C,102C,105C) ok
12 Air inlet 24C (56C,68C,71C) ok
12 Air inlet remote 22C (46C,59C,62C) ok
12 Air outlet 27C (66C,76C,79C) ok
12 Air outlet remote 27C (60C,71C,74C) ok
13 Air inlet 23C (56C,68C,71C) ok
13 Air inlet remote 21C (46C,59C,62C) ok
13 Air outlet 26C (66C,76C,79C) ok
13 Air outlet remote 26C (60C,71C,74C) ok
Power Fan Inline
Supply Model No Type Status Sensor Status
PS1 PWR-C45-2800AC AC 2800W good good good
PS2 PWR-C45-2800AC AC 2800W good good good
Power supplies needed by system : 1
Power supplies currently available : 2
Chassis Type : WS-C4506-E
Power consumed by backplane : 0 Watts
Switch Bandwidth Utilization : 0%
Supervisor Led Color : Green
Module 11 Status Led Color : Green
Module 12 Status Led Color : Green PoE Led Color : Green
Module 13 Status Led Color : Green PoE Led Color : Green
Beacon Led Status : off
Fantray : Good
Fantray removal timeout : 240
Power consumed by Fantray : 120 Watts`
我看您在博文中提到了参考文档:
https://stackoverflow.com/questions/44471749/golang-enter-ssh-sudo-password-on-prompt-or-exit
但项目中并没有加入此机制?
sudo要求输密码的时候就会卡住
已解决了
可否支持多个IP,不同端口,不同用户名,不同密码的形式
IP | 端口 | 用户名 | 密码
10.0.1.22 | 1022 | aa | pass01
10.0.2.51 | 1222 | bb | pass02
10.0.3.52 | 1322 | cc | pass03
10.0.4.53 | 22 | dd | pass04
HUAWEI S5720
Lines 56 to 58 in 87e2079
⚠️ not enough arguments in call to connect
have (string, string, string, string, number, []string)
want (string, string, string, string, int, []string, []string)
在上述代码中 connect
函数没有足够的函数参数。
multissh 在执行时,cmds中存在多个空格就会抛出超时错误。
例如
➜ multissh ./main -hostfile host.txt -u root -p nsfocus2018 -cmds "top -n 1"
2019/01/08 10:28:04 Multissh start
2019/01/08 10:28:34 Multissh finished. Process time 30.001343414s. Number of active ip is 1
host: 172.19.252.217
========= Result =========
SSH run timeout:30 second.
具体遇到如下问题,希望大大修复
multissh版本0.3.0
nexus交换机型号
cisco Nexus9000 C93180YC-FX
nexus交换机版本
Software
BIOS: version 05.39
NXOS: version 7.0(3)I7(8)
BIOS compile time: 08/30/2019
NXOS image file is: bootflash:///nxos.7.0.3.I7.8.bin
NXOS compile time: 3/3/2020 20:00:00 [03/04/2020 12:49:49]
multissh.exe -hosts "192.168.1.1" -u "user123" -p "password123" -cmds "terminal length 0;show run"
2022/01/19 14:48:40 Multissh start
2022/01/19 14:48:40 Multissh finished. Process time 294.2006ms. Number of active ip is 1
host: 172.26.252.247
========= Result =========
<ssh: handshake failed: ssh: no common algorithm for key exchange; client offered: [diffie-hellman-group-exchange-sha1 diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha256], server offered: [diffie-hellman-group14-sha1 ecdh-sha2-nistp256 ecdh-sha2-nistp384]>
你好,请问这个工具目前能实现免密操作功能吗?虽然可以使用密钥,但台量大不太好管理,大多数母机都是从管理节点执行的,希望后面可以实现。多谢了
你好!能否增加功能,提供支持windows64下可视化操作的客户端?
<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]>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.