官网
https://github.com/huashengdun/webssh
安装
pip install webssh
[root@hadoop15 ~]# pip install webssh
Collecting webssh
Downloading webssh-1.5.2.tar.gz (182 kB)
|████████████████████████████████| 182 kB 136 kB/s
Collecting tornado>=4.5.0
Downloading tornado-6.0.4.tar.gz (496 kB)
|████████████████████████████████| 496 kB 1.9 MB/s
Collecting paramiko>=2.3.1
Downloading paramiko-2.7.1-py2.py3-none-any.whl (206 kB)
|████████████████████████████████| 206 kB 5.5 MB/s
Collecting cryptography>=2.5
Downloading cryptography-3.0-cp35-abi3-manylinux2010_x86_64.whl (2.7 MB)
|████████████████████████████████| 2.7 MB 5.1 MB/s
Collecting bcrypt>=3.1.3
Downloading bcrypt-3.1.7-cp34-abi3-manylinux1_x86_64.whl (56 kB)
|████████████████████████████████| 56 kB 3.9 MB/s
Collecting pynacl>=1.0.1
Downloading PyNaCl-1.4.0-cp35-abi3-manylinux1_x86_64.whl (961 kB)
|████████████████████████████████| 961 kB 4.3 MB/s
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.6/site-packages (from cryptography>=2.5->paramiko>=2.3.1->webssh) (1.15.0)
Collecting cffi!=1.11.3,>=1.8
Downloading cffi-1.14.1-cp36-cp36m-manylinux1_x86_64.whl (400 kB)
|████████████████████████████████| 400 kB 4.5 MB/s
Collecting pycparser
Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
|████████████████████████████████| 112 kB 4.7 MB/s
Building wheels for collected packages: webssh, tornado
Building wheel for webssh (setup.py) ... done
Created wheel for webssh: filename=webssh-1.5.2-py2.py3-none-any.whl size=162478 sha256=68eb75f62cf5a88bd944c91302ce37d37fabe1a4c364fa1093e2db0a5f8a4bde
Stored in directory: /root/.cache/pip/wheels/f0/5f/d1/dda83bd8ae57b30b756a3aff587ddfb6ba3daf7b9eceacd4bd
Building wheel for tornado (setup.py) ... done
Created wheel for tornado: filename=tornado-6.0.4-cp36-cp36m-linux_x86_64.whl size=422953 sha256=7abee4e7652d0c4b1049ec8b1bc27ac7468364aba89ea861e70ab6f8d71de01d
Stored in directory: /root/.cache/pip/wheels/37/a7/db/2d592e44029ef817f3ef63ea991db34191cebaef087a96f505
Successfully built webssh tornado
Installing collected packages: tornado, pycparser, cffi, cryptography, bcrypt, pynacl, paramiko, webssh
Successfully installed bcrypt-3.1.7 cffi-1.14.1 cryptography-3.0 paramiko-2.7.1 pycparser-2.20 pynacl-1.4.0 tornado-6.0.4 webssh-1.5.2
[root@hadoop15 ~]#
启动 wssh 服务
wssh
[root@hadoop15 ~]# wssh
[I 200727 09:09:36 settings:125] WarningPolicy
[I 200727 09:09:36 main:39] Listening on :8888 (http)
访问
默认是监听本地的 8888 端口,如我的是:http://192.168.5.15:8888/,如下图所示。
连接 ssh
填入基本ssh信息,ssh成功了。
高级使用
自定义启动规则
# 指定端口和ip启动
wssh --address='2.2.2.2' --port=8000
# start a https server, certfile and keyfile must be passed
wssh --certfile='/path/to/cert.crt' --keyfile='/path/to/cert.key'
# missing host key policy
wssh --policy=reject
# logging level
wssh --logging=debug
# log to file
wssh --log-file-prefix=main.log
# more options
wssh --help
参数登录
http://localhost:8888/?hostname=xx&username=yy&password=str_base64_encoded
如下所示,password=cm9vdA== 后面的字符串时 base64 加密的。
http://192.168.5.15:8888/?hostname=192.168.5.15&username=root&password=cm9vdA==
连接成功如下图所示: