asyncssh

AsyncSSH is a Python package which provides an asynchronous client and server implementation of the SSHv2 protocol on top of the Python asyncio framework. It requires Python 3.4 or later and the Py…

Github星跟踪图

AsyncSSH: Asynchronous SSH for Python

AsyncSSH is a Python package which provides an asynchronous client and
server implementation of the SSHv2 protocol on top of the Python 3.6+
asyncio framework.

.. code:: python

import asyncio, asyncssh, sys

async def run_client():
async with asyncssh.connect('localhost') as conn:
result = await conn.run('echo "Hello!"', check=True)
print(result.stdout, end='')

try:
asyncio.get_event_loop().run_until_complete(run_client())
except (OSError, asyncssh.Error) as exc:
sys.exit('SSH connection failed: ' + str(exc))

Check out the examples__ to get started!

__ http://asyncssh.readthedocs.io/en/stable/#client-examples

Features

  • Full support for SSHv2, SFTP, and SCP client and server functions

    • Shell, command, and subsystem channels
    • Environment variables, terminal type, and window size
    • Direct and forwarded TCP/IP channels
    • OpenSSH-compatible direct and forwarded UNIX domain socket channels
    • Local and remote TCP/IP port forwarding
    • Local and remote UNIX domain socket forwarding
    • Dynamic TCP/IP port forwarding via SOCKS
    • X11 forwarding support on both the client and the server
    • SFTP protocol version 3 with OpenSSH extensions
    • SCP protocol support, including third-party remote to remote copies
  • Multiple simultaneous sessions on a single SSH connection

  • Multiple SSH connections in a single event loop

  • Byte and string based I/O with settable encoding

  • A variety of key exchange, encryption, and MAC__ algorithms

  • Support for gzip compression__

    • Including OpenSSH variant to delay compression until after auth
  • User and host-based public key, password, and keyboard-interactive
    authentication methods

  • Many types and formats of public keys and certificates__

    • Including support for X.509 certificates as defined in RFC 6187
  • Support for accessing keys managed by ssh-agent__ on UNIX systems

    • Including agent forwarding support on both the client and the server
  • Support for accessing keys managed by PuTTY's Pageant agent on Windows

  • Support for accessing host keys via OpenSSH's ssh-keysign

  • OpenSSH-style known_hosts file__ support

  • OpenSSH-style authorized_keys file__ support

  • Compatibility with OpenSSH "Encrypt then MAC" option for better security

  • Time and byte-count based session key renegotiation

  • Designed to be easy to extend to support new forms of key exchange,
    authentication, encryption, and compression algorithms

__ http://asyncssh.readthedocs.io/en/stable/api.html#key-exchange-algorithms
__ http://asyncssh.readthedocs.io/en/stable/api.html#encryption-algorithms
__ http://asyncssh.readthedocs.io/en/stable/api.html#mac-algorithms
__ http://asyncssh.readthedocs.io/en/stable/api.html#compression-algorithms
__ http://asyncssh.readthedocs.io/en/stable/api.html#public-key-support
__ http://asyncssh.readthedocs.io/en/stable/api.html#ssh-agent-support
__ http://asyncssh.readthedocs.io/en/stable/api.html#known-hosts
__ http://asyncssh.readthedocs.io/en/stable/api.html#authorized-keys

License

This package is released under the following terms:

Copyright (c) 2013-2019 by Ron Frederick ronf@timeheart.net and others.

This program and the accompanying materials are made available under
the terms of the Eclipse Public License v2.0 which accompanies this
distribution and is available at:

http://www.eclipse.org/legal/epl-2.0/

This program may also be made available under the following secondary
licenses when the conditions for such availability set forth in the
Eclipse Public License v2.0 are satisfied:

 GNU General Public License, Version 2.0, or any later versions of
 that license

SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

For more information about this license, please see the Eclipse Public License FAQ <https://www.eclipse.org/legal/epl-2.0/faq.php>_.

Prerequisites

To use AsyncSSH 2.0 or later, you need the following:

  • Python 3.6 or later
  • cryptography (PyCA) 2.8 or later

Installation

Install AsyncSSH by running:

::

pip install asyncssh

Optional Extras
^^^^^^^^^^^^^^^

There are some optional modules you can install to enable additional
functionality:

AsyncSSH defines the following optional PyPI extra packages to make it
easy to install any or all of these dependencies:, bcrypt, gssapi, libnacl, pyOpenSSL, pypiwin32

For example, to install bcrypt, gssapi, libnacl, and pyOpenSSL on UNIX,
you can run:

::

pip install 'asyncssh[bcrypt,gssapi,libnacl,pyOpenSSL]'

To install bcrypt, libnacl, pyOpenSSL, and pypiwin32 on Windows, you can run:

::

pip install 'asyncssh[bcrypt,libnacl,pyOpenSSL,pypiwin32]'

Note that you will still need to manually install the libsodium library
listed above for libnacl to work correctly and/or libnettle for UMAC
support. Unfortunately, since libsodium and libnettle are not Python
packages, they cannot be directly installed using pip.

Installing the development branch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you would like to install the development branch of asyncssh directly
from Github, you can use the following command to do this:

::

  pip install git+https://github.com/ronf/asyncssh@develop

Mailing Lists

Three mailing lists are available for AsyncSSH:

  • asyncssh-announce@googlegroups.com__: Project announcements
  • asyncssh-dev@googlegroups.com__: Development discussions
  • asyncssh-users@googlegroups.com__: End-user discussions

__ http://groups.google.com/d/forum/asyncssh-announce
__ http://groups.google.com/d/forum/asyncssh-dev
__ http://groups.google.com/d/forum/asyncssh-users

主要指标

概览
名称与所有者ronf/asyncssh
主编程语言Python
编程语言Python (语言数: 1)
平台
许可证Eclipse Public License 2.0
所有者活动
创建于2013-12-29 11:44:51
推送于2025-10-27 00:19:35
最后一次提交2025-09-29 00:10:53
发布数96
最新版本名称v2.21.1 (发布于 2025-09-29 00:11:19)
第一版名称v0.1.0 (发布于 2013-09-22 13:19:02)
用户参与
星数1.7k
关注者数36
派生数166
提交数1.3k
已启用问题?
问题数619
打开的问题数4
拉请求数32
打开的拉请求数0
关闭的拉请求数80
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?