findssh


Namefindssh JSON
Version 2.0.1 PyPI version JSON
download
home_page
Summaryfind open servers on IPv4 subnet such as SSH
upload_time2024-01-29 03:46:34
maintainer
docs_urlNone
author
requires_python>=3.9
license
keywords port-scan ssh
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Find SSH servers (without NMAP)

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3336467.svg)](https://doi.org/10.5281/zenodo.3336467)
![ci](https://github.com/scivision/findssh/workflows/ci/badge.svg)
[![PyPI Download stats](http://pepy.tech/badge/findssh)](http://pepy.tech/project/findssh)

Platform-independently find SSH servers (or other services with open ports) on an IPv4 subnet in pure Python WITHOUT NMAP.
Scan entire IPv4 subnet in less than 1 second using Python standard library `asyncio`  coroutines and a single thread.

The default
[asyncio coroutine](https://docs.python.org/3/library/asyncio.html)
uses a single thread and is more than 10x faster than
[concurrent.futures.ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html).

Although speed advantages weren't seen in our testing, `findssh` works with PyPy as well.

```sh
pip install findssh
```

or from this repo:

```sh
git clone https://github.com/scivision/findssh

pip install -e findssh
```

## Usage

A canonical way to use FindSSH from other Python scripts is [asyncio](example/asyncio_get_hosts.py).

---

from command line:

```sh
python -m findssh
```

or use project script e.g. from [pipx](https://github.com/pypa/pipx):

```sh
findssh
```

* `-s`  check the string from the server to attempt to verify the correct service has been found
* `-t` timeout per server (seconds)  useful for high latency connection
* `-b` baseip (check other subnet besides your own)
* `-p` network port to scan (default 22)

## Benchmark

These tests used 500 ms timeout on WiFi.

Coroutine (single thread, fast, lean, recommended):

```ipython
%timeit findssh.main()

522 ms ± 1.26 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```

Thread pool (100 thread max, slow, heavy):

```ipython
%timeit findssh.threadpool.main()

1.39 s ± 213 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```

Trying to open too many threads via ThreadPoolExecutor can cause a system error like

```
OSError: [Errno 24] Too many open files
```

Thus in practical terms, using coroutines can be significantly faster than threads while using less system resources.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "findssh",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "port-scan,ssh",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/88/d3/d4255d464a94031fde04ba548e2a995eaca67fe1be16ae295a42c7ec31c7/findssh-2.0.1.tar.gz",
    "platform": null,
    "description": "# Find SSH servers (without NMAP)\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3336467.svg)](https://doi.org/10.5281/zenodo.3336467)\n![ci](https://github.com/scivision/findssh/workflows/ci/badge.svg)\n[![PyPI Download stats](http://pepy.tech/badge/findssh)](http://pepy.tech/project/findssh)\n\nPlatform-independently find SSH servers (or other services with open ports) on an IPv4 subnet in pure Python WITHOUT NMAP.\nScan entire IPv4 subnet in less than 1 second using Python standard library `asyncio`  coroutines and a single thread.\n\nThe default\n[asyncio coroutine](https://docs.python.org/3/library/asyncio.html)\nuses a single thread and is more than 10x faster than\n[concurrent.futures.ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html).\n\nAlthough speed advantages weren't seen in our testing, `findssh` works with PyPy as well.\n\n```sh\npip install findssh\n```\n\nor from this repo:\n\n```sh\ngit clone https://github.com/scivision/findssh\n\npip install -e findssh\n```\n\n## Usage\n\nA canonical way to use FindSSH from other Python scripts is [asyncio](example/asyncio_get_hosts.py).\n\n---\n\nfrom command line:\n\n```sh\npython -m findssh\n```\n\nor use project script e.g. from [pipx](https://github.com/pypa/pipx):\n\n```sh\nfindssh\n```\n\n* `-s`  check the string from the server to attempt to verify the correct service has been found\n* `-t` timeout per server (seconds)  useful for high latency connection\n* `-b` baseip (check other subnet besides your own)\n* `-p` network port to scan (default 22)\n\n## Benchmark\n\nThese tests used 500 ms timeout on WiFi.\n\nCoroutine (single thread, fast, lean, recommended):\n\n```ipython\n%timeit findssh.main()\n\n522 ms \u00b1 1.26 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n```\n\nThread pool (100 thread max, slow, heavy):\n\n```ipython\n%timeit findssh.threadpool.main()\n\n1.39 s \u00b1 213 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n```\n\nTrying to open too many threads via ThreadPoolExecutor can cause a system error like\n\n```\nOSError: [Errno 24] Too many open files\n```\n\nThus in practical terms, using coroutines can be significantly faster than threads while using less system resources.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "find open servers on IPv4 subnet such as SSH",
    "version": "2.0.1",
    "project_urls": null,
    "split_keywords": [
        "port-scan",
        "ssh"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a369ff162b25674f7b94568549a8512a06eaa1152737e2d2f56eaacf62f53a8",
                "md5": "5ee55595c455d7148098b73264ffe590",
                "sha256": "37d13ffa92c3d13e33327f8ed2cc73bd4baf2a54c2360f31b2f9c99d5e46e4e0"
            },
            "downloads": -1,
            "filename": "findssh-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5ee55595c455d7148098b73264ffe590",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8499,
            "upload_time": "2024-01-29T03:46:32",
            "upload_time_iso_8601": "2024-01-29T03:46:32.797301Z",
            "url": "https://files.pythonhosted.org/packages/7a/36/9ff162b25674f7b94568549a8512a06eaa1152737e2d2f56eaacf62f53a8/findssh-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88d3d4255d464a94031fde04ba548e2a995eaca67fe1be16ae295a42c7ec31c7",
                "md5": "1273d8bbe96f3e4cf1705fef21ac37f6",
                "sha256": "563b26a332584b6f4a1703b45561e5e57e7abb70cec2e879c8403e72565a793d"
            },
            "downloads": -1,
            "filename": "findssh-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1273d8bbe96f3e4cf1705fef21ac37f6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7787,
            "upload_time": "2024-01-29T03:46:34",
            "upload_time_iso_8601": "2024-01-29T03:46:34.200455Z",
            "url": "https://files.pythonhosted.org/packages/88/d3/d4255d464a94031fde04ba548e2a995eaca67fe1be16ae295a42c7ec31c7/findssh-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-29 03:46:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "findssh"
}
        
Elapsed time: 0.16993s