Skip to main content

SSH with account managing

Project description

sshx (SSH with account managing)

Build Status codecov license

sshx is a lightweight ssh client with account managing. You can assign names to your accounts and connect with the name, without input the username, host, port, password, identity.

Installation

Install from pypi

For Windows:

pip install --extra-index-url https://wqyjh.github.io/python-wheels/ sshx

For Linux, macOS:

pip install sshx

Install from source

For Windows:

pip install --extra-index-url https://wqyjh.github.io/python-wheels/ git+https://github.com/WqyJh/sshx

# Or

pip install -i  https://wqyjh.github.io/python-wheels/ pyHook
python setup.py install

# Or

pip install -r requirements.txt

For Linux, macOX:

pip install git+https://github.com/WqyJh/sshx

# Or

python setup.py install

# Or

pip install -r requirements.txt

Quick Start

  1. Initialization.
sshx init
  1. Adding an account.
sshx add myhost -l test@192.168.9.155

(This command will ask you to type your password and sshx would store the encrypted password.)

  1. Connect to the account.
sshx connect myhost

Usage

sshx init

Create the following files which storing the account info. If the files are damaged you'll probably lost all the accounts, so DON'T TOUCH IT. If this happened, use this command to re-init and use add command to re-add them.

~/.sshx
└── .accounts

sshx add

# add an account in an simpler way
sshx add myhost user@host:port

# add an account and specify an password for authentication
sshx add myhost -H host -P port -u user -p

# add an account and specify an identity file for authentication
sshx add myhost -H host -P port -u user -i identity_file

# add an account and specify both password and identity file for authentication
sshx add myhost -H host -P port -u user -p -i identity_file
  • Host and user option are required for adding an account.
  • Either a password or a identity option is required for adding an account. You can also specify both of them for an account. In this case, only using identity for authentication(maybe improved later).
  • Password are input from the prompt, which won't show in the screen.

sshx list

List all the accounts as the following format.

name                          host                          user
------------------------------------------------------------------------------------------
host1                         192.168.9.188                 user1
host2                         192.168.9.155                 user2
host3                         192.168.9.156                 user3
test                          192.168.9.157                 user4

sshx del

Delete an account.

sshx del host1

sshx update

Update an account.

The arguments list is same with add command, all the specified fields will be updated.

# change the host1's host field to domain.com
sshx update host1 -H domain.com

# change the host1's password
sshx update host1 -p

# change the host1's identity to identity2
sshx update host1 -i identity2

# change the host1's name to host2, and the next time you want to 
# change the account you have to use `sshx update host2 ...`
sshx update host1 -n host2

sshx connect

Connect to an account.

sshx connect host1

Test

python setup.py test

Todo

  • scp support
  • jump host support
  • X11Forward support(test)

Bugs

1. python2 setup.py test failed on every test case related to itsdangerous.

The traceback looks as follow. Seems the function want_bytes was None.

======================================================================
ERROR: test_encrypt_decrypt (sshx.tests.test_tokenizer.TokenizerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\win-projects\PythonProjects\sshx\sshx\tests\test_tokenizer.py", line 12, in test_encrypt_decrypt
    t = tokenizer.encrypt(s, k)
  File "D:\win-projects\PythonProjects\sshx\sshx\tokenizer.py", line 14, in encrypt
    s = URLSafeSerializer(key)
  File "D:\win-programs\venv\sshxpy2\lib\site-packages\itsdangerous.py", line 518, in __init__
    self.secret_key = want_bytes(secret_key)
TypeError: 'NoneType' object is not callable

I don't know what caused it, but it passes all when I run the tests with unittest command

python -m unittest discover -t ./ -s sshx/tests -v

All tests passed with python3.

So I think it's the bug of setuptools, and it only affects tests running with python2. Therefore the bug has nothing to do with the usage but cause the CI failure.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[0.1.1] - 2018-10-18

Added

  • Add auto-adjust window size.
  • Add abbrev syntax for add command

[0.0.11] - 2018-06-20

Added

  • Add ssh interactive shell based on paramiko.
  • Use argparse to parse commandline arguments.
  • Add support for config file.
  • Add password encryption.
  • Add python2 support.
  • Add unittest.
  • Add travis ci support.
  • Add code coverage test.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sshx-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sshx-0.1.1-py2.py3-none-any.whl (27.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sshx-0.1.1.tar.gz.

File metadata

  • Download URL: sshx-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.4rc1

File hashes

Hashes for sshx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 300d300238ea57839c92bdb9c65835f8d2e606ce9f8dcd1aff3fe63aa5f4828b
MD5 edaa0fd62da546d78c8637c04e57ba37
BLAKE2b-256 218db349c2d4903c5585affce982c53b5d0c4ecba6f22a17ba1e7ae6147f6d52

See more details on using hashes here.

File details

Details for the file sshx-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: sshx-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.4rc1

File hashes

Hashes for sshx-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3be3a6e488cfbde979963fe710ddb841404afb7d79ebbbbf214701300a3f88b8
MD5 44762ccfc7b84e3f032c390d4293c40d
BLAKE2b-256 62227b9b064876652ac1ad3b393a2d9529dc56242bfd10c7fae7d198ef0b5f93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page