Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace #136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Trace #136

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions _setup_libssh2.py
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
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
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
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