Skip to main content

find open servers on IPv4 subnet such as SSH

Project description

Find SSH servers (without NMAP)

DOI ci PyPI Download stats

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 uses a single thread and is more than 10x faster than concurrent.futures.ThreadPoolExecutor.

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

pip install findssh

or from this repo:

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

pip install -e findssh

Usage

A canonical way to use FindSSH from other Python scripts is asyncio.


from command line:

python -m findssh

or use project script e.g. from pipx:

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):

%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):

%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.

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

findssh-2.0.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

findssh-2.0.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file findssh-2.0.1.tar.gz.

File metadata

  • Download URL: findssh-2.0.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for findssh-2.0.1.tar.gz
Algorithm Hash digest
SHA256 563b26a332584b6f4a1703b45561e5e57e7abb70cec2e879c8403e72565a793d
MD5 1273d8bbe96f3e4cf1705fef21ac37f6
BLAKE2b-256 88d3d4255d464a94031fde04ba548e2a995eaca67fe1be16ae295a42c7ec31c7

See more details on using hashes here.

File details

Details for the file findssh-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: findssh-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for findssh-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37d13ffa92c3d13e33327f8ed2cc73bd4baf2a54c2360f31b2f9c99d5e46e4e0
MD5 5ee55595c455d7148098b73264ffe590
BLAKE2b-256 7a369ff162b25674f7b94568549a8512a06eaa1152737e2d2f56eaacf62f53a8

See more details on using hashes here.

Supported by

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