## WebSSH
[![Build Status](https://travis-ci.org/huashengdun/webssh.svg?branch=master)](https://travis-ci.org/huashengdun/webssh)
[![codecov](https://codecov.io/gh/huashengdun/webssh/branch/master/graph/badge.svg)](https://codecov.io/gh/huashengdun/webssh)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/webssh.svg)
![PyPI](https://img.shields.io/pypi/v/webssh.svg)
### Introduction
A simple web application to be used as an ssh client to connect to your ssh servers. It is written in Python, base on tornado, paramiko and xterm.js.
### Features
* SSH password authentication supported, including empty password.
* SSH public-key authentication supported, including DSA RSA ECDSA Ed25519 keys.
* Encrypted keys supported.
* Two-Factor Authentication(time-based one-time password) supported.
* Fullscreen terminal supported.
* Terminal window resizable.
* Auto detect the ssh server's default encoding.
* Modern browsers including Chrome, Firefox, Safari, Edge, Opera supported.
### Preview
![Login](https://github.com/huashengdun/webssh/raw/master/preview/login.png)
![Terminal](https://github.com/huashengdun/webssh/raw/master/preview/terminal.png)
### How it works
```
+---------+ http +--------+ ssh +-----------+
| browser | <==========> | webssh | <=======> | ssh server|
+---------+ websocket +--------+ ssh +-----------+
```
### Requirements
* Python 2.7/3.4+
### Quickstart
1. Install this app, run command `pip install webssh`
2. Start a webserver, run command `wssh`
3. Open your browser, navigate to `127.0.0.1:8888`
4. Input your data, submit the form.
### Server options
```bash
# start a http server with specified listen address and listen port
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
```
### Browser console
```javascript
// connect to your ssh server
wssh.connect(hostname, port, username, password, privatekey, passphrase, totp);
// pass an object to wssh.connect
var opts = {
hostname: 'hostname',
port: 'port',
username: 'username',
password: 'password',
privatekey: 'the private key text',
passphrase: 'passphrase',
totp: 'totp'
};
wssh.connect(opts);
// without an argument, wssh will use the form data to connect
wssh.connect();
// set a new encoding for client to use
wssh.set_encoding(encoding);
// reset encoding to use the default one
wssh.reset_encoding();
// send a command to the server
wssh.send('ls -l');
```
### Custom Font
Custom font family usage example:
```html
<style>
@font-face {
font-family: 'font-name';
src: url('static/css/fonts/your-favorite-font');
}
body {
font-family: 'font-name';
}
</style>
```
### URL Arguments
Support passing arguments by url (query or fragment) like following examples:
Passing form data (password must be encoded in base64)
```bash
http://localhost:8888/?hostname=xx&username=yy&password=str_base64_encoded
```
Passing a terminal background color
```bash
http://localhost:8888/#bgcolor=green
```
Passing a user defined title
```bash
http://localhost:8888/?title=my-ssh-server
```
Passing an encoding
```bash
http://localhost:8888/#encoding=gbk
```
Passing a command
```bash
http://localhost:8888/?command=pwd
```
### Use Docker
Start up the app
```
docker-compose up
```
Tear down the app
```
docker-compose down
```
### Tests
Use unittest to run all tests
```
python -m unittest discover tests
```
Use pytest to run all tests
```
python -m pytest tests
```
### Deployment
Running behind an Nginx server
```bash
wssh --address='127.0.0.1' --port=8888 --policy=reject
```
```nginx
# Nginx config example
location / {
proxy_pass http://127.0.0.1:8888;
proxy_http_version 1.1;
proxy_read_timeout 300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
}
```
Running as a standalone server
```bash
wssh --port=8080 --sslport=4433 --certfile='cert.crt' --keyfile='cert.key' --xheaders=False --policy=reject
```
### Tips
* For whatever deployment choice you choose, don't forget to enable SSL.
* By default plain http requests from a public network will be either redirected or blocked and being redirected takes precedence over being blocked.
* Try to use reject policy as the missing host key policy along with your verified known_hosts, this will prevent man-in-the-middle attacks. The idea is that it checks the system host keys file("~/.ssh/known_hosts") and the application host keys file("./known_hosts") in order, if the ssh server's hostname is not found or the key is not matched, the connection will be aborted.
没有合适的资源?快使用搜索试试~ 我知道了~
Python-WebSSH一个基于Web的ssh客户端
共55个文件
py:19个
js:6个
key:5个
需积分: 50 10 下载量 42 浏览量
2019-08-12
07:24:53
上传
评论
收藏 315KB ZIP 举报
温馨提示
WebSSH 一个简单的Web应用程序可用作ssh客户端连接到您的ssh服务器。 它是用Python编写的,基于tornado和paramiko。
资源推荐
资源详情
资源评论
收起资源包目录
Python-WebSSH一个基于Web的ssh客户端.zip (55个子文件)
huashengdun-webssh-49a64b7
MANIFEST.in 241B
README.rst 5KB
.github
FUNDING.yml 119B
Dockerfile 108B
preview
login.png 59KB
terminal.png 97KB
run.py 69B
requirements.txt 95B
.travis.yml 328B
LICENSE 1KB
setup.cfg 133B
setup.py 1KB
README.md 5KB
docker-compose.yml 72B
tests
test_app.py 29KB
test_policy.py 4KB
utils.py 1KB
test_main.py 624B
__init__.py 0B
sshserver.py 7KB
test_settings.py 6KB
test_handler.py 9KB
data
test_known_hosts 98B
known_hosts_example3 95B
known_hosts_example 95B
test_ed25519_password.key 484B
test_ed25519.key 432B
user_rsa_key 887B
test_rsa_password.key 951B
test_rsa.key 883B
cert.crt 1KB
cert.key 2KB
known_hosts_example2 95B
test_utils.py 4KB
webssh
settings.py 5KB
handler.py 17KB
_version.py 80B
utils.py 3KB
main.py 2KB
policy.py 3KB
__init__.py 114B
templates
index.html 3KB
worker.py 4KB
static
img
favicon.png 6KB
js
xterm.min.js 198KB
fullscreen.min.js 1KB
main.js 19KB
jquery.min.js 85KB
popper.min.js 21KB
bootstrap.min.js 55KB
css
xterm.min.css 1KB
bootstrap.min.css 152KB
fullscreen.min.css 145B
.gitignore 777B
.coveragerc 203B
共 55 条
- 1
资源评论
普通网友
- 粉丝: 484
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功