Created
February 8, 2019 14:19
-
-
Save chrishuan9/9ac18d068ba2e08c69c8180af7c1cdd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio, asyncssh, sys | |
async def run_client(): | |
#async with asyncssh.connect('localhost',kex_algs=["diffie-hellman-group1-sha1"],known_hosts=None,username='ridgeline',password='47e4b27ad353033a6c2fc969a7beddaf',signature_algs=['ssh-dss']) as conn: | |
async with asyncssh.connect('10.28.8.1',kex_algs=['diffie-hellman-group-exchange-sha256','diffie-hellman-group-exchange-sha1','diffie-hellman-group1-sha1','diffie-hellman-group14-sha1','diffie-hellman-group14-sha256','diffie-hellman-group15-sha512','diffie-hellman-group16-sha512','diffie-hellman-group17-sha512','diffie-hellman-group18-sha512'],known_hosts=None,username='ridgeline',password='47e4b27ad353033a6c2fc969a7beddaf',signature_algs=['ssh-dss']) as conn: | |
result = await conn.run('ls', check=True) | |
print(result.stdout, end='') | |
def main(): | |
try: | |
asyncio.get_event_loop().run_until_complete(run_client()) | |
except (OSError, asyncssh.Error) as exc: | |
sys.exit('SSH connection failed: ' + str(exc)) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio, asyncssh, sys | |
async def run_client(): | |
#async with asyncssh.connect('localhost',kex_algs=["diffie-hellman-group1-sha1"],known_hosts=None,username='ridgeline',password='47e4b27ad353033a6c2fc969a7beddaf',signature_algs=['ssh-dss']) as conn: | |
async with asyncssh.connect('10.28.8.1',kex_algs=['diffie-hellman-group-exchange-sha256','diffie-hellman-group-exchange-sha1','diffie-hellman-group1-sha1','diffie-hellman-group14-sha1','diffie-hellman-group14-sha256','diffie-hellman-group15-sha512','diffie-hellman-group16-sha512','diffie-hellman-group17-sha512','diffie-hellman-group18-sha512'],known_hosts=None,username='ridgeline',password='47e4b27ad353033a6c2fc969a7beddaf',signature_algs=['ssh-dss']) as conn: | |
result = await conn.run('ls', check=True) | |
print(result.stdout, end='') | |
def main(): | |
try: | |
asyncio.get_event_loop().run_until_complete(run_client()) | |
except (OSError, asyncssh.Error) as exc: | |
sys.exit('SSH connection failed: ' + str(exc)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment