From eb55ae2cceac286fb727d036eff838561e11dc6e Mon Sep 17 00:00:00 2001 From: Sheng Date: Fri, 27 Apr 2018 00:04:48 +0800 Subject: [PATCH] Added setup.py setup.cfg --- README.md | 19 +++++++------------ setup.cfg | 7 +++++++ setup.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ webssh/__init__.py | 4 ++++ webssh/_version.py | 2 ++ 5 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 webssh/_version.py diff --git a/README.md b/README.md index 9a52428..2fe3ef8 100644 --- a/README.md +++ b/README.md @@ -20,28 +20,26 @@ A simple web application to be used as an ssh client to connect to your ssh serv ### Instructions ``` git clone https://github.com/huashengdun/webssh.git -cd webssh -pip install -r requirements.txt -cd webssh -python main.py +pip install ./webssh/ +wssh ``` ### Options ``` # configure listen address and port -python main.py --address='0.0.0.0' --port=8000 +wssh --address='0.0.0.0' --port=8000 # configure missing host key policy -python main.py --policy=reject +wssh --policy=reject # configure logging level -python main.py --logging=debug +wssh --logging=debug # log to file -python main.py --log-file-prefix=main.log +wssh --log-file-prefix=main.log # more options -python main.py --help +wssh --help ``````` ### Nginx config example for running this app behind an nginx server @@ -61,6 +59,3 @@ location / { ### Tips * Try to use Nginx as a front web server (see config example above) and enable SSL, this will prevent your ssh credentials from being uncovered. Also afterwards the communication between your browser and the web server will be encrypted as they use secured websockets. * 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. - -### Todo -Add more unittests diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0a6b547 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ +[metadata] +license_file = LICENSE + + +[flake8] +exclude = .git,build,dist,tests, __init__.py +max-line-length = 79 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..959e676 --- /dev/null +++ b/setup.py @@ -0,0 +1,46 @@ +import codecs +from setuptools import setup +from webssh._version import __version__ as version + + +starts = [u'### Preview', u'![Login]', u'![Terminal]'] + + +def starts_with(line): + for start in starts: + if line.startswith(start): + return True + + +with codecs.open('README.md', encoding='utf-8') as f: + long_description = ''.join(line for line in f if not starts_with(line)) + + +setup( + name='webssh', + version=version, + description='Web based ssh client', + long_description=long_description, + author='Shengdun Hua', + author_email='webmaster0115@gmail.com', + url='https://github.com/huashengdun/webssh', + packages=['webssh'], + entry_points=''' + [console_scripts] + wssh = webssh.main:main + ''', + license='MIT', + classifiers=[ + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + ], + install_requires=[ + 'tornado>=4.5.0', + 'paramiko>=2.3.1', + ], +) diff --git a/webssh/__init__.py b/webssh/__init__.py index e69de29..e48fd8e 100644 --- a/webssh/__init__.py +++ b/webssh/__init__.py @@ -0,0 +1,4 @@ +from webssh._version import __version__, __version_info__ + + +__author__ = 'Shengdun Hua ' diff --git a/webssh/_version.py b/webssh/_version.py new file mode 100644 index 0000000..40e09a2 --- /dev/null +++ b/webssh/_version.py @@ -0,0 +1,2 @@ +__version_info__ = (0, 1, 0) +__version__ = '.'.join(map(str, __version_info__))