ssh-hosts


Namessh-hosts JSON
Version 0.4.0 PyPI version JSON
download
home_page
SummaryQuickly connect to host entries from your SSH config file
upload_time2023-06-07 18:56:45
maintainer
docs_urlNone
authorChristoph Stein
requires_python>=3.9
licenseMIT
keywords ssh hosts network
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SSH-Hosts

Simple script to list all host entries in your SSH configuration. You can then choose to quickly connect to one or more of them. This is handy if you organize a bunch of host entries in your SSH client config like, e.g.:

```
# Including files is also supported
Include /path/to/my/other/config/file

Host foo
  Hostname foohost
  User foouser
  IdentityFile fookey

Host bar
  Hostname barhost
  User baruser
  IdentityFile barkey
```

Notes:

* It is also possible to use wildcards in your SSH client config to set values for multiple hosts at once. This script will *not* show these entries, since they cannot be used to connect to a host directly.

## Installation

  * Install from pypi: ```pip install ssh-hosts```

  OR

  * Download the pip package from GitLab
  * Install it with pip, e.g. pip install sshhosts-0.4.0-py3-none-any.whl

## Basic usage

Just run
```
ssh-hosts
```
Running with no arguments will read in your ssh configuration from ```~/.ssh/config``` and list all found host entries. Type the number of an entry to connect to that given host.

## Command line arguments overview

```
optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -c CONFIG, --config CONFIG
                        Path to configuration file
  -e EXCLUDE, --exclude EXCLUDE
                        Exclude hosts based on python regular expression
  -s SSH_COMMAND, --ssh_command SSH_COMMAND
                        SSH command
  -l, --loop            Do not exit when ssh session ends, show host list again instead
  -t, --terminal_tab_mode
                        Attempt to start ssh session in new tab/window of terminal
  -o, --sort_host_entries
                        Sort host entries
  -r, --reverse_order   Reverse sorting order
  -g, --gui             Use a curses-like input dialog
```

## Arguments

### Path to SSH configuration

```
ssh-hosts -c '<path to ssh config>'
```
This will read in the SSH configuration file from the given path instead of ```~/.ssh/config```.


### Excluding hosts

```
ssh-hosts -e '<python regex>'
```
You can exclude host entries from the list based on a Python regular expression which needs to match *exactly*.

e.g.
```
ssh-hosts -e 'foo'
```
Will only exclude a host named 'foo', but not one named 'foo1'. To exclude both 'foo' and 'foo1' you could use

```
ssh-hosts -e 'foo\w*'
```

...or any other appropriate Python regular expression.

### Using a custom ssh command

```
ssh-hosts -s '<shell/ssh command>'
```

You can supply a custom command which ssh-hosts will use when you pick a host. The default is just 'ssh'.

Examples:

Start ssh connection with debug output
```
ssh-hosts -s 'ssh -v'
```

### Terminal tab mode

Experimental.

Tries so start ssh connections in new tabs if running in *Windows Terminal*, or in new windows when running in *tmux*.

```
ssh-hosts --terminal_tab_mode
```

You can combine this with ```loop``` mode to keep the list of hosts open on one tab/window of your terminal and quickly launch connections in new tabs/windows.

e.g.
```
ssh-hosts --terminal_tab_mode --loop
```

## Licensing

Licensed under the MIT license, see also LICENSE.txt

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ssh-hosts",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "SSH,Hosts,Network",
    "author": "Christoph Stein",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1f/d1/81c83e2d41d48e0ae1ce7b02f70cad104968990151403229c34499c1dec1/ssh-hosts-0.4.0.tar.gz",
    "platform": null,
    "description": "# SSH-Hosts\n\nSimple script to list all host entries in your SSH configuration. You can then choose to quickly connect to one or more of them. This is handy if you organize a bunch of host entries in your SSH client config like, e.g.:\n\n```\n# Including files is also supported\nInclude /path/to/my/other/config/file\n\nHost foo\n  Hostname foohost\n  User foouser\n  IdentityFile fookey\n\nHost bar\n  Hostname barhost\n  User baruser\n  IdentityFile barkey\n```\n\nNotes:\n\n* It is also possible to use wildcards in your SSH client config to set values for multiple hosts at once. This script will *not* show these entries, since they cannot be used to connect to a host directly.\n\n## Installation\n\n  * Install from pypi: ```pip install ssh-hosts```\n\n  OR\n\n  * Download the pip package from GitLab\n  * Install it with pip, e.g. pip install sshhosts-0.4.0-py3-none-any.whl\n\n## Basic usage\n\nJust run\n```\nssh-hosts\n```\nRunning with no arguments will read in your ssh configuration from ```~/.ssh/config``` and list all found host entries. Type the number of an entry to connect to that given host.\n\n## Command line arguments overview\n\n```\noptional arguments:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n  -c CONFIG, --config CONFIG\n                        Path to configuration file\n  -e EXCLUDE, --exclude EXCLUDE\n                        Exclude hosts based on python regular expression\n  -s SSH_COMMAND, --ssh_command SSH_COMMAND\n                        SSH command\n  -l, --loop            Do not exit when ssh session ends, show host list again instead\n  -t, --terminal_tab_mode\n                        Attempt to start ssh session in new tab/window of terminal\n  -o, --sort_host_entries\n                        Sort host entries\n  -r, --reverse_order   Reverse sorting order\n  -g, --gui             Use a curses-like input dialog\n```\n\n## Arguments\n\n### Path to SSH configuration\n\n```\nssh-hosts -c '<path to ssh config>'\n```\nThis will read in the SSH configuration file from the given path instead of ```~/.ssh/config```.\n\n\n### Excluding hosts\n\n```\nssh-hosts -e '<python regex>'\n```\nYou can exclude host entries from the list based on a Python regular expression which needs to match *exactly*.\n\ne.g.\n```\nssh-hosts -e 'foo'\n```\nWill only exclude a host named 'foo', but not one named 'foo1'. To exclude both 'foo' and 'foo1' you could use\n\n```\nssh-hosts -e 'foo\\w*'\n```\n\n...or any other appropriate Python regular expression.\n\n### Using a custom ssh command\n\n```\nssh-hosts -s '<shell/ssh command>'\n```\n\nYou can supply a custom command which ssh-hosts will use when you pick a host. The default is just 'ssh'.\n\nExamples:\n\nStart ssh connection with debug output\n```\nssh-hosts -s 'ssh -v'\n```\n\n### Terminal tab mode\n\nExperimental.\n\nTries so start ssh connections in new tabs if running in *Windows Terminal*, or in new windows when running in *tmux*.\n\n```\nssh-hosts --terminal_tab_mode\n```\n\nYou can combine this with ```loop``` mode to keep the list of hosts open on one tab/window of your terminal and quickly launch connections in new tabs/windows.\n\ne.g.\n```\nssh-hosts --terminal_tab_mode --loop\n```\n\n## Licensing\n\nLicensed under the MIT license, see also LICENSE.txt\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Quickly connect to host entries from your SSH config file",
    "version": "0.4.0",
    "project_urls": {
        "documentation": "https://gitlab.com/s7one/ssh-hosts",
        "homepage": "https://gitlab.com/s7one/ssh-hosts",
        "repository": "https://gitlab.com/s7one/ssh-hosts"
    },
    "split_keywords": [
        "ssh",
        "hosts",
        "network"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "81e6ce7ed8f7f5fd08d79c36334758ee67f3b19067160fe179858fae88928308",
                "md5": "f0c67790170b51a81b8def73d22f06f1",
                "sha256": "7d2a21701031de31e8c30ea393a22732f512aa210675a9367e62ea49ef9ef149"
            },
            "downloads": -1,
            "filename": "ssh_hosts-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0c67790170b51a81b8def73d22f06f1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7539,
            "upload_time": "2023-06-07T18:56:43",
            "upload_time_iso_8601": "2023-06-07T18:56:43.526835Z",
            "url": "https://files.pythonhosted.org/packages/81/e6/ce7ed8f7f5fd08d79c36334758ee67f3b19067160fe179858fae88928308/ssh_hosts-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1fd181c83e2d41d48e0ae1ce7b02f70cad104968990151403229c34499c1dec1",
                "md5": "85f9cbaecc0d7c897662cb80d3a09e3b",
                "sha256": "d5b51bf5b2c51727de32ee7d4e877ad39658eb53ebcdb18f336f583944a5ae91"
            },
            "downloads": -1,
            "filename": "ssh-hosts-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "85f9cbaecc0d7c897662cb80d3a09e3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6962,
            "upload_time": "2023-06-07T18:56:45",
            "upload_time_iso_8601": "2023-06-07T18:56:45.172548Z",
            "url": "https://files.pythonhosted.org/packages/1f/d1/81c83e2d41d48e0ae1ce7b02f70cad104968990151403229c34499c1dec1/ssh-hosts-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-07 18:56:45",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "s7one",
    "gitlab_project": "ssh-hosts",
    "lcname": "ssh-hosts"
}
        
Elapsed time: 0.07263s