一个简单的并行SSH工具,可以批量的对主机通过SSH执行命令组合。
支持:
并发执行
单次执行多条命令
ip地址段自动匹配主机(192.168.0.1-192.168.0.100)
ssh用户名/密码认证
sshkey认证
json格式输出
输出到文本,文件名为host.txt
编译go get ./...go buildrelease可以直接下载编译好的release版本
提供win64和linux64两个平台的可执行文件
https://github.com/shanghai-edu/multissh/releases/
命令体系# ./multissh -hUsage of ./multissh: -c string cfg File Path -ciphers string ciphers -cmdfile string cmdfile path -cmds string cmds -hostfile string hostfile path -hosts string host address list -ipfile string ipfile path -ips string ip address list -j print output in json format -k string ssh private key -l In linux mode,multi command combine with && ,such as date&&cd /opt&&ls -n int max execute number (default 20) -outTxt write result into txt -p string password -port int ssh port (default 22) -t int max timeout (default 30) -u string username -v show versioncmdfile示例
show clockhostfile示例
192.168.31.21192.168.15.102ipfile示例
192.168.15.101-192.168.15.103192.168.31.21-192.168.31.22ssh.json示例
{ "SshHosts": [ { "Host": "192.168.31.51", "Port": 22, "Username": "admin", "Password": "admin","cmds":"show clock;show clock" }, { "Host": "192.168.80.131", "Port": 22, "Username": "root", "Password": "", "key": "./server.key", "linuxMode": true, "CmdFile": "cmd2.txt.example" } ]}
评论