tryssh 是一个拥有猜密码功能的命令行ssh终端工具。
tryssh可以非常方便在命令行中通过ssh协议连接服务器,也可以非常方便地管理服务器的登陆账号密码等信息。
tryssh拥有跨平台的能力,可以在多种操作系统上正常工作。
tryssh github仓库地址
注意:因
tryssh
有并发猜密码的功能,所以tryssh理论上拥有暴力破解服务器密码的能力。不建议使用tryssh
去做类似事情。
引用自github仓库中README的例子
# 创建一个名为 testuser 的备选用户
tryssh create users testuser
# 创建备选端口号 22
tryssh create ports 22
# 创建一个备选密码
tryssh create passwords 123456
# 用以上创建的信息尝试登陆 192.168.1.1
tryssh ssh 192.168.1.1
截止 v0.3.10版本
$ tryssh -h
command line ssh terminal tool.
Usage:
tryssh [command]
Available Commands:
alias Set, unset, and list aliases, aliases can be used to log in to servers
create Create alternate username, port number, password, and login cache information
delete Delete alternate username, port number, password, and login cache information
get Get alternate username, port number, password, and login cache information
help Help about any command
prune Check if all current caches are available and clear the ones that are not available
scp Upload/Download file to/from the server through SSH protocol
ssh Connect to the server through SSH protocol
version Print the client version information for the current context
Flags:
-h, --help help for tryssh
Use "tryssh [command] --help" for more information about a command.
tryssh 的create
命令用于创建用来猜密码登陆的各类配置,比如用户名、端口号和密码,也可以直接创建已知用户名、端口号和密码的缓存。
$ tryssh create -h
Create alternate username, port number, password, and login cache information
Usage:
tryssh create [command]
Available Commands:
caches Create a alternate cache
passwords Create a alternate password
ports Create a alternate port
users Create a alternate username
Flags:
-h, --help help for create
Use "tryssh create [command] --help" for more information about a command.
# 创建一个名为 testuser 的备选用户
tryssh create users testuser
# 创建备选端口号 22
tryssh create ports 22
# 创建一个备选密码
tryssh create passwords 123456
tryssh 的delete
命令用于删除用来猜密码登陆的各类配置,比如用户名、端口号和密码,也可以直接删除缓存。
$ tryssh delete -h
Delete alternate username, port number, password, and login cache information
Usage:
tryssh delete [command]
Available Commands:
caches Delete a alternate cache
passwords Delete a alternate password
ports Delete a alternate port
users Delete a alternate username
Flags:
-h, --help help for delete
Use "tryssh delete [command] --help" for more information about a command.
# 删除一个名为 testuser 的备选用户
tryssh delete users testuser
# 删除备选端口号 22
tryssh delete ports 22
# 删除一个备选密码
tryssh delete passwords 123456
# 删除服务器192.168.1.1的登陆缓存
tryssh delete caches 192.168.1.1
tryssh 的get
命令用于查看用来猜密码登陆的各类配置,比如用户名、端口号、密码以及登陆缓存。
$ tryssh get -h
Get alternate username, port number, password, and login cache information
Usage:
tryssh get [command]
Available Commands:
caches Get alternate caches by ipAddress
passwords Get alternate passwords
ports Get alternate ports
users Get alternate usernames
Flags:
-h, --help help for get
Use "tryssh get [command] --help" for more information about a command.
# 查看用于猜密码的候选用户
tryssh get users
# 查看用于猜密码的候选端口号
tryssh get ports
# 查看当前已有的登陆缓存
tryssh get caches
tryssh的prune
命令用于测试当前已有缓存是否依然可用,如果不可用可以选择执行删除缓存,也可以不询问直接删除缓存。
$ tryssh prune -h
Check if all current caches are available and clear the ones that are not available
Usage:
tryssh prune [flags]
Flags:
-a, --auto Automatically perform concurrent cache optimization without asking for confirmation to delete
-c, --concurrency int Number of multiple requests to perform at a time (default 8)
-h, --help help for prune
-t, --timeout duration SSH timeout when attempting to log in. It can be "1s" or "1m" or other duration (default 2s)
# 交互式进行缓存可用性测试
tryssh prune
# 非交互进行缓存可用性测试
tryssh prune -a
# 非交互进行缓存可用性测试,同时设置并发数为10(默认为8),连接超时时间为5秒(默认为2秒)
tryssh prune -c 10 -t 5s -a
交互式模式下设置并发数是无效的
tryssh 的alias
命令是用于给 已有 的缓存设置别名用的,方便在登陆或者传输文件时直接使用别名来操作
$ tryssh alias -h
Set, unset, and list aliases, aliases can be used to log in to servers
Usage:
tryssh alias [command]
Available Commands:
list List all alias
set Set an alias for the specified server address
unset Unset the alias
Flags:
-h, --help help for alias
Use "tryssh alias [command] --help" for more information about a command.
# 查看当前所有别名
tryssh alias list
# 给192.168.1.1服务器设置一个名为"host1"的别名
tryssh alias set host1 -t 192.168.1.1
# 取消名为"host1"的别名
tryssh alias unset host1
tryssh 的ssh
命令用于猜密码登陆服务器,在成功获取正确登陆信息后会缓存这些信息以便下次直接使用缓存登陆,不用重新猜密码。
chenjingyu@MacBook ~ % tryssh ssh -h
Connect to the server through SSH protocol
Usage:
tryssh ssh [flags]
Flags:
-c, --concurrency int Number of multiple requests to perform at a time (default 8)
-h, --help help for ssh
-t, --timeout duration SSH timeout when attempting to log in. It can be "1s" or "1m" or other duration (default 1s)
-u, --user string Specify a username to attempt to login to the server,
if the specified username does not exist, try logging in using that username
# 登陆192.168.1.1服务器,如果没有缓存则尝试猜密码登陆
tryssh ssh 192.168.1.1
# 登陆别名为host1的服务器
tryssh ssh host1
# 登陆192.168.1.1服务器,如果没有缓存则尝试猜密码登陆,同时设置并发数为20,超时时间为500毫秒,指定登陆的用户为root
tryssh ssh 192.168.1.1 -c 20 -t 500ms -u root
tryssh 的scp
命令用于上传或者下载文件或者目录,scp
命令支持使用别名
chenjingyu@MacBook ~ % tryssh scp -h
Upload/Download file to/from the server through SSH protocol
Usage:
tryssh scp
scp的使用例子在帮助信息里已经有阐述,下面只是做翻译
# 从192.168.1.1服务器上下载test.txt文件放到本地的./目录
tryssh scp 192.168.1.1:/root/test.txt ./
# 从本地上传test.txt文件到192.168.1.1的/root/目录下
tryssh scp ./test.txt 192.168.1.1:/root/
# 从192.168.1.1服务器上下载test.txt文件到本地./目录下并改名为test2.txt
tryssh scp 192.168.1.1:/root/test.txt ./test2.txt
# 从192.168.1.1服务器上下载testDir目录到本地的~/Downloads/下
tryssh scp -r 192.168.1.1:/root/testDir ~/Downloads/
# 上传本地的testDir目录到192.168.1.1服务器/root/下并改名为testDir2
tryssh scp -r ~/Downloads/testDir 192.168.1.1:/root/testDir2
如果觉得tryssh
好用,别忘了去给github仓库点个星星,然后给身边的同事朋友推荐一下tryssh
,开源社区需要你的支持。
如果使用中遇到了问题也建议积极去github提交issue。