← 返回首页
Trace by pkittenis · Pull Request #136 · ParallelSSH/ssh2-python · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus
Open

Trace #136

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .pxd  (1) .py  (4) .pyx  (1) All 4 file types selected Only manifest files Viewed files
Conversations
Failed to load comments. Retry
Loading
Jump to
Jump to file
Failed to load files. Retry
Loading
Diff view
Unified
Split
Hide whitespace
Apply and reload
Show whitespace
Diff view
Unified
Split
Hide whitespace
Apply and reload
6 changes: 4 additions & 2 deletions _setup_libssh2.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def build_ssh2():
os.chdir('src')
check_call('cmake ../libssh2 -DBUILD_SHARED_LIBS=ON \
-DENABLE_ZLIB_COMPRESSION=ON -DENABLE_CRYPT_NONE=ON \
-DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL',
-DENABLE_MAC_NONE=ON -DCRYPTO_BACKEND=OpenSSL \
-DENABLE_DEBUG_LOGGING=ON',
shell=True, env=os.environ)
check_call('cmake --build . --config Release', shell=True, env=os.environ)
# check_call('cmake --build . --config Release', shell=True, env=os.environ)
check_call('cmake --build . --config Debug', shell=True, env=os.environ)
os.chdir('..')

for src in glob('src/src/libssh2.so*'):
Expand Down
22 changes: 17 additions & 5 deletions examples/example_echo.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import print_function
import os
import socket
from datetime import datetime

from ssh2.session import Session
from ssh2.utils import version
Expand Down Expand Up @@ -35,20 +36,31 @@

# Channel initialise, exec and wait for end
channel = session.open_session()
channel.execute('echo me')
channel.wait_eof()
channel.close()
channel.wait_closed()
channel.shell()
channel.write("sleep 1; echo this took one second\n")
channel.write("for x in 1 2 3; do sleep 1; echo a line per second for three seconds; done\n")
channel.write("sleep 1; echo this took another second\n")
# channel.execute('echo me')
# channel.send_eof()
# channel.close()
# channel.wait_closed()

# Get exit status
print("Exit status: %s" % channel.get_exit_status())
# print("Exit status: %s" % channel.get_exit_status())

# Print output
start = datetime.now()
channel.send_eof()
channel.wait_eof()
size, data = channel.read()
while size > 0:
print(data)
size, data = channel.read()

print("Exit code: %s" % (channel.get_exit_status()))
end = datetime.now()
print("Took %s seconds" % (end - start).total_seconds())

# SFTP capabilities, uncomment and enter a filename

# sftp = session.sftp_init()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
version=versioneer.get_version(),
cmdclass=cmdclass,
url='https://github.com/ParallelSSH/ssh2-python',
license='LGPLv2',
license='LGPLv2.1',
author='Panos Kittenis',
author_email='22e889d8@opayq.com',
description=('Super fast SSH library - bindings for libssh2'),
Expand Down
10 changes: 10 additions & 0 deletions ssh2/c_ssh2.pxd
Show comments View file Edit file Delete file Open in desktop
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,13 @@ cdef extern from "libssh2.h" nogil:
const char *path)
IF HAVE_AGENT_FWD:
int libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel)
enum:
LIBSSH2_TRACE_TRANS
LIBSSH2_TRACE_KEX
LIBSSH2_TRACE_AUTH
LIBSSH2_TRACE_CONN
LIBSSH2_TRACE_SCP
LIBSSH2_TRACE_SFTP
LIBSSH2_TRACE_ERROR
LIBSSH2_TRACE_PUBLICKEY
LIBSSH2_TRACE_SOCKET
Loading
Toggle all file notes Toggle all file annotations

Footer

© 2026 GitHub, Inc.