跨平台命令行ssh终端工具tryssh详解

编程入门 行业动态 更新时间:2024-10-23 04:39:59

跨平台命令行ssh<a href=https://www.elefans.com/category/jswz/34/1771374.html style=终端工具tryssh详解"/>

跨平台命令行ssh终端工具tryssh详解

tryssh

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 -hcommand line ssh terminal tool.Usage:tryssh [command]Available Commands:alias       Set, unset, and list aliases, aliases can be used to log in to serverscreate      Create alternate username, port number, password, and login cache informationdelete      Delete alternate username, port number, password, and login cache informationget         Get alternate username, port number, password, and login cache informationhelp        Help about any commandprune       Check if all current caches are available and clear the ones that are not availablescp         Upload/Download file to/from the server through SSH protocolssh         Connect to the server through SSH protocolversion     Print the client version information for the current contextFlags:-h, --help   help for trysshUse "tryssh [command] --help" for more information about a command.

create 命令

tryssh 的create命令用于创建用来猜密码登陆的各类配置,比如用户名、端口号和密码,也可以直接创建已知用户名、端口号和密码的缓存。

create 帮助信息
$ tryssh create -h
Create alternate username, port number, password, and login cache informationUsage:tryssh create [command]Available Commands:caches      Create a alternate cachepasswords   Create a alternate passwordports       Create a alternate portusers       Create a alternate usernameFlags:-h, --help   help for createUse "tryssh create [command] --help" for more information about a command.
create 使用举例
# 创建一个名为 testuser 的备选用户
tryssh create users testuser# 创建备选端口号 22
tryssh create ports 22# 创建一个备选密码
tryssh create passwords 123456

delete 命令

tryssh 的delete命令用于删除用来猜密码登陆的各类配置,比如用户名、端口号和密码,也可以直接删除缓存。

delete 帮助信息
$ tryssh delete -h
Delete alternate username, port number, password, and login cache informationUsage:tryssh delete [command]Available Commands:caches      Delete a alternate cachepasswords   Delete a alternate passwordports       Delete a alternate portusers       Delete a alternate usernameFlags:-h, --help   help for deleteUse "tryssh delete [command] --help" for more information about a command.
delete 使用举例
# 删除一个名为 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

get 命令

tryssh 的get命令用于查看用来猜密码登陆的各类配置,比如用户名、端口号、密码以及登陆缓存。

get 帮助信息
$ tryssh get -h
Get alternate username, port number, password, and login cache informationUsage:tryssh get [command]Available Commands:caches      Get alternate caches by ipAddresspasswords   Get alternate passwordsports       Get alternate portsusers       Get alternate usernamesFlags:-h, --help   help for getUse "tryssh get [command] --help" for more information about a command.
get 使用举例
# 查看用于猜密码的候选用户
tryssh get users# 查看用于猜密码的候选端口号
tryssh get ports# 查看当前已有的登陆缓存
tryssh get caches

prune 命令

tryssh的prune命令用于测试当前已有缓存是否依然可用,如果不可用可以选择执行删除缓存,也可以不询问直接删除缓存。

prune 帮助信息
$ tryssh prune -h
Check if all current caches are available and clear the ones that are not availableUsage: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)
prune 使用举例
# 交互式进行缓存可用性测试
tryssh prune# 非交互进行缓存可用性测试
tryssh prune -a# 非交互进行缓存可用性测试,同时设置并发数为10(默认为8),连接超时时间为5秒(默认为2秒)
tryssh prune -c 10 -t 5s -a

交互式模式下设置并发数是无效的

alias 命令

tryssh 的alias命令是用于给 已有 的缓存设置别名用的,方便在登陆或者传输文件时直接使用别名来操作

alias 帮助信息
$ tryssh alias -h
Set, unset, and list aliases, aliases can be used to log in to serversUsage:tryssh alias [command]Available Commands:list        List all aliasset         Set an alias for the specified server addressunset       Unset the aliasFlags:-h, --help   help for aliasUse "tryssh alias [command] --help" for more information about a command.
alias 使用举例
# 查看当前所有别名
tryssh alias list# 给192.168.1.1服务器设置一个名为"host1"的别名
tryssh alias set host1 -t 192.168.1.1# 取消名为"host1"的别名
tryssh alias unset host1

ssh 命令

tryssh 的ssh命令用于猜密码登陆服务器,在成功获取正确登陆信息后会缓存这些信息以便下次直接使用缓存登陆,不用重新猜密码。

ssh 帮助信息
chenjingyu@MacBook ~ % tryssh ssh -h
Connect to the server through SSH protocolUsage:tryssh ssh <ipAddress> [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
ssh 使用举例
# 登陆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

scp 命令

tryssh 的scp命令用于上传或者下载文件或者目录,scp命令支持使用别名

scp 帮助信息
chenjingyu@MacBook ~ % tryssh scp -h
Upload/Download file to/from the server through SSH protocolUsage:tryssh scp <source> <destination> [flags]Examples:
# Download test.txt file from 192.168.1.1 and place it under ./
tryssh scp 192.168.1.1:/root/test.txt ./
# Upload test.txt file to 192.168.1.1 and place it under /root/
tryssh scp ./test.txt 192.168.1.1:/root/
# Download test.txt file from 192.168.1.1 and rename it to test2.txt and place it under ./
tryssh scp 192.168.1.1:/root/test.txt ./test2.txt# Download testDir directory from 192.168.1.1 and place it under ~/Downloads/
tryssh scp -r 192.168.1.1:/root/testDir ~/Downloads/
# Upload testDir directory to 192.168.1.1 and rename it to testDir2 and place it under /root/
tryssh scp -r ~/Downloads/testDir 192.168.1.1:/root/testDir2Flags:-c, --concurrency int    Number of multiple requests to perform at a time (default 8)-h, --help               help for scp-r, --recursive          Recursively copy entire directories-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
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。

更多推荐

跨平台命令行ssh终端工具tryssh详解

本文发布于:2023-12-05 21:09:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1665293.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:终端   命令行   详解   工具   平台

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!