公司的碉堡项目,提供了ssh代理服务,客户端可以通过ssh连接到代理端,代理端
再连接到目标机,如果要对这个功能做性能测试怎么做呢?
能通过Python脚本并发调用ssh连接吗,不能简单的连接就行,而是要一直交互式的执行,也许是我不知道怎么实现,我是通过了Mac下的终端连接工具来实现的
iTerm2
preferences设置连接信息
为了实现免交互填写密码,你需要安装
sshpass
提供密码 /usr/local/bin/sshpass -p 123456 ssh -p 40022 [email protected]
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5SOxIWZxczN2UzYiJmNxYTOjRjY0ETNkNjM2cDZmVTM38CX5d2bs92Yl1iclB3bsVmdlR2LcNWaw9CXt92Yu4GZjlGbh5yYjV3Lc9CX6MHc0RHaiojIsJye.png)
iterm2
脚本内容
test.scpt
tell application "iTerm2"
create window with default profile
tell current window
repeat 30 times
create tab with profile "test"
end repeat
end tell
end tell
使用Mac的
osascript
执行脚本
$ osascript test.scpt
tab 31 of window id 87376
效果如下图,30个ssh连接上了,并自动执行top命令,以此来验证代理端的性能,你们说行的通吗