ssht
SSH client wrapper for easily connecting to hosts
This wrapper for the well known ssh client makes it possible to connect to the right server with just typing a part of the host name. The external sources are queried using the search term and those matching the string will be presented as an option.
Current supported sources:
- JSON file
- MySQL database
- JSON API endpoint
- Custom parser class
Installation
Install ssht using pip:
pip3 install ssht
or if you want the latest version:
pip3 install https://github.com/hkraal/ssht/archive/master.zip
Usage
ssht [-h] name [-4] [-6]
positional arguments:
name name of the host to connect to
optional arguments:
-h, --help show this help message and exit
-4 connect using ipv4 (skip dns if ipv4 address is defined)
-6 connect using ipv6 (skip dns of ipv6 address is defined)
Example of a connection
$ ssht host01
1) root@host01.exmaple.com
2) host01.exmaple.com
Connect to: 1
Connecting to "host01.example.com"
root@host01:~$
Configuration
Create ssht folder in home directory
mkdir ~/.ssht
Configure sources in ~/.ssht:
Define servers in JSON format:
{
"hosts": [
{
"port": "2222",
"hostname": "host01.example.com",
"ipv4": "192.168.0.2",
"user": "root"
},
{
"port": "2222",
"hostname": "host01.example.com",
"ipv4": "192.168.0.2",
}
]
}
Define servers in MySQL:
{
"config": {
"host": "localhost",
"user": "username",
"password": "passeword",
"database": "infra"
},
"query": "SELECT hostname, port, ipv4, ipv6, user FROM servers"
}
Define JSON API endpoint:
{
"config": {
"url": "http://ssht-api.dev",
"headers": {
"Authentication": "bla:huk"
}
}
}
Define custom class:
- Create a Python package containing your class
from ssht.plugins import Parser, Host
class ExampleParser(Parser):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._files = self.get_files('.custom')
def search(self, needle):
return [
Host(hostname='host01.example.com', ipv4='192.168.0.2'),
]
- Enable your class in
~/.ssht/config.json
{
"parsers":
[
"ssht.plugins.JsonParser",
"ssht_provider.ExampleParser"
]
}
Release files for ssht 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ssht-3.0.2.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ssht-3.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / ssht-3.0.2.tar.gz
| Download URL | ssht-3.0.2.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a49c7da34eb02c98877861483bb42f39b5acaf5eb2b6854d11f2858747a7c67
|
|
BLAKE2b-256 checksum How to use checksums |
cfe510dd021680ac01ae1b84a519d8e4a439f2d0df5b93918617a1eb88ca2f82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.11.10 Darwin/25.3.0
|
Release files / ssht-3.0.2-py3-none-any.whl
| Download URL | ssht-3.0.2-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c710c2272720176fc5dc8e849fb12bee18ff12c1bc6165519633f41da1ec450
|
|
BLAKE2b-256 checksum How to use checksums |
adcd11b822da9fe7fec0024fa446a1ccfaf5c81d73d84820c0f95a07fe42fbb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.11.10 Darwin/25.3.0
|