Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-paramiko-expect for openSUSE:Factory checked in at 2022-10-14 15:41:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-paramiko-expect (Old) and /work/SRC/openSUSE:Factory/.python-paramiko-expect.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-paramiko-expect" Fri Oct 14 15:41:23 2022 rev:5 rq:1010373 version:0.3.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-paramiko-expect/python-paramiko-expect.changes 2022-08-11 18:32:37.622261429 +0200 +++ /work/SRC/openSUSE:Factory/.python-paramiko-expect.new.2275/python-paramiko-expect.changes 2022-10-14 15:42:06.119874586 +0200 @@ -1,0 +2,6 @@ +Wed Oct 12 13:51:17 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 0.3.4 + * No upstream changelog + +------------------------------------------------------------------- Old: ---- paramiko-expect-0.3.2.tar.gz New: ---- paramiko-expect-0.3.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-paramiko-expect.spec ++++++ --- /var/tmp/diff_new_pack.QE2xBT/_old 2022-10-14 15:42:06.567875334 +0200 +++ /var/tmp/diff_new_pack.QE2xBT/_new 2022-10-14 15:42:06.571875341 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-paramiko-expect -Version: 0.3.2 +Version: 0.3.4 Release: 0 Summary: An expect-like extension for the Paramiko SSH library License: MIT ++++++ paramiko-expect-0.3.2.tar.gz -> paramiko-expect-0.3.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/LICENSE new/paramiko-expect-0.3.4/LICENSE --- old/paramiko-expect-0.3.2/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/paramiko-expect-0.3.4/LICENSE 2022-09-19 20:21:34.000000000 +0200 @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Fotis Gimian + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/PKG-INFO new/paramiko-expect-0.3.4/PKG-INFO --- old/paramiko-expect-0.3.2/PKG-INFO 2022-01-13 13:07:35.973393200 +0100 +++ new/paramiko-expect-0.3.4/PKG-INFO 2022-09-19 20:26:16.785066100 +0200 @@ -1,213 +1,216 @@ Metadata-Version: 2.1 Name: paramiko-expect -Version: 0.3.2 +Version: 0.3.4 Summary: An expect-like extension for the Paramiko SSH library Home-page: https://github.com/fgimian/paramiko-expect Author: Fotis Gimian Author-email: fgimiansoftw...@gmail.com License: MIT -Description: Paramiko Expect - =============== - - .. image:: https://img.shields.io/pypi/l/paramiko-expect.svg - :target: https://github.com/fgimian/paramiko-expect/blob/master/LICENSE - - .. image:: https://codecov.io/gh/fgimian/paramiko-expect/branch/master/graph/badge.svg - :target: https://codecov.io/gh/fgimian/paramiko-expect - - .. image:: https://img.shields.io/travis/fgimian/paramiko-expect.svg - :target: https://travis-ci.org/fruch/paramiko-expect/ - - .. image:: https://img.shields.io/pypi/v/paramiko-expect.svg - :target: https://pypi.python.org/pypi/paramiko-expect/ - - .. image:: https://img.shields.io/pypi/pyversions/paramiko-expect.svg - :target: https://pypi.python.org/pypi/paramiko-expect/ - - - .. image:: https://raw.githubusercontent.com/fgimian/paramiko-expect/master/images/paramiko-expect-logo.png - :alt: Paramiko Expect Logo - - Artwork courtesy of `Open Clip Art - Library <https://openclipart.org/detail/174780/openmouthed-robot>`_ - - Introduction - ------------ - - Paramiko Expect provides an expect-like extension for the Paramiko SSH library - which allows scripts to fully interact with hosts via a true SSH - connection. - - The class is constructed with an SSH Client object (this will likely be - extended to support a transport in future for more flexibility). - - Quick Start - ----------- - - To install paramiko-expect, simply run the following at your prompt: - - .. code:: bash - - # from pypi - pip install paramiko-expect - - # from source - pip install git+https://github.com/fgimian/paramiko-expect.git - - So let's check out how it works in general (please see - `paramiko_expect-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo.py>`_ - for the complete code): - - .. code:: python - - # Connect to the host - client.connect(hostname=hostname, username=username, password=password) - - # Create a client interaction class which will interact with the host - interact = SSHClientInteraction(client, timeout=10, display=True) - interact.expect(prompt) - - # Run the first command and capture the cleaned output, if you want the output - # without cleaning, simply grab current_output instead. - interact.send('uname -a') - interact.expect(prompt) - cmd_output_uname = interact.current_output_clean - - # Now let's do the same for the ls command but also set a timeout for this - # specific expect (overriding the default timeout) - interact.send('ls -l /') - interact.expect(prompt, timeout=5) - cmd_output_ls = interact.current_output_clean - - # To expect multiple expressions, just use a list. You can also selectively - # take action based on what was matched. - - # Method 1: You may use the last_match property to find out what was matched - interact.send('~/paramiko_expect-demo-helper.py') - interact.expect([prompt, 'Please enter your name: ']) - if interact.last_match == 'Please enter your name: ': - interact.send('Fotis Gimian') - interact.expect(prompt) - - # Method 2: You may use the matched index to determine the last match (like pexpect) - interact.send('~/paramiko_expect-demo-helper.py') - found_index = interact.expect([prompt, 'Please enter your name: ']) - if found_index == 1: - interact.send('Fotis Gimian') - interact.expect(prompt) - - # Send the exit command and expect EOF (a closed session) - interact.send('exit') - interact.expect() - - # Print the output of each command - print '-'*79 - print 'Cleaned Command Output' - print '-'*79 - print 'uname -a output:' - print cmd_output_uname - print 'ls -l / output:' - print cmd_output_ls - - **Important**: Before running this script, be sure to place - `paramiko_expect-demo-helper.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo-helper.py>`_ - in ``~``. - - The print statements at the bottom of the script provide the following - output: - - .. code:: bash - - ------------------------------------------------------------------------------- - Cleaned Command Output - ------------------------------------------------------------------------------- - uname -a output: - Linux fotsies-ubuntu-testlab 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux - - ls -l / output: - total 77 - drwxr-xr-x 2 root root 4096 May 1 22:21 bin - drwxr-xr-x 4 root root 1024 May 1 22:22 boot - drwxr-xr-x 15 root root 4300 Jun 12 15:00 dev - drwxr-xr-x 90 root root 4096 Jun 12 16:45 etc - drwxr-xr-x 4 root root 4096 May 1 23:37 home - lrwxrwxrwx 1 root root 33 May 1 22:18 initrd.img -> /boot/initrd.img-3.2.0-23-generic - drwxr-xr-x 18 root root 4096 May 1 22:21 lib - drwxr-xr-x 2 root root 4096 May 1 22:17 lib64 - drwx------ 2 root root 16384 May 1 22:17 lost+found - drwxr-xr-x 4 root root 4096 May 1 22:18 media - drwxr-xr-x 2 root root 4096 Apr 19 19:32 mnt - drwxr-xr-x 2 root root 4096 May 1 22:17 opt - dr-xr-xr-x 84 root root 0 Jun 12 15:00 proc - drwx------ 3 root root 4096 May 30 23:32 root - drwxr-xr-x 15 root root 560 Jun 12 17:02 run - drwxr-xr-x 2 root root 4096 Jun 4 20:59 sbin - drwxr-xr-x 2 root root 4096 Mar 6 04:54 selinux - drwxr-xr-x 2 root root 4096 May 1 22:17 srv - drwxr-xr-x 13 root root 0 Jun 12 15:00 sys - drwxrwxrwt 2 root root 4096 Jun 12 16:17 tmp - drwxr-xr-x 10 root root 4096 May 1 22:17 usr - drwxr-xr-x 12 root root 4096 Jun 12 13:16 var - lrwxrwxrwx 1 root root 29 May 1 22:18 vmlinuz -> boot/vmlinuz-3.2.0-23-generic - - For interacting with tail-like scripts, we can use the tail function (please see - `paramiko_expect-tail-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-tail-demo.py>`_ - for the complete code): - - .. code:: python - - # Connect to the host - client.connect(hostname=hostname, username=username, password=password) - - # Create a client interaction class which will interact with the host - interact = SSHClientInteraction(client, timeout=10, display=False) - interact.expect(prompt) - - # Send the tail command - interact.send('tail -f /var/log/auth.log') - - # Now let the class tail the file for us - interact.tail(line_prefix=hostname+': ') - - The true power of the tail function will become more apparent when you - check out the `Multi-SSH <https://github.com/fgimian/multissh>`_ - library. Ever thought about tailing a log on multiple servers? Well - dream no more my friend, it's here! - - - Tests - ----- - - Not full coverage yet, and assumes you have docker setup: - - .. code:: bash - - pip install -r requirements-test.txt - docker run -d -p 2222:22 -v `pwd`/examples:/examples -v `pwd`/test/id_rsa.pub:/root/.ssh/authorized_keys docker.io/panubo/sshd - pytest -s --cov paramiko_expect --cov-report term-missing - - - Contributions - ------------- - - - Israel Fruchter (@fruch) - Tests / CI / Uploads to Pypi - - Kiseok Kim (@kiseok7) - Vagrent image - - - License - ------- - - Paramiko Expect is released under the **MIT** license. Please see the - `LICENSE <https://github.com/fgimian/paramiko-expect/blob/master/LICENSE>`_ - file for more details. - Platform: Posix Classifier: Development Status :: 4 - Beta Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Intended Audience :: Developers Description-Content-Type: text/x-rst +License-File: LICENSE + +Paramiko Expect +=============== + +.. image:: https://img.shields.io/pypi/l/paramiko-expect.svg + :target: https://github.com/fgimian/paramiko-expect/blob/master/LICENSE + +.. image:: https://codecov.io/gh/fgimian/paramiko-expect/branch/master/graph/badge.svg + :target: https://codecov.io/gh/fgimian/paramiko-expect + +.. image:: https://img.shields.io/travis/fgimian/paramiko-expect.svg + :target: https://travis-ci.org/fruch/paramiko-expect/ + +.. image:: https://img.shields.io/pypi/v/paramiko-expect.svg + :target: https://pypi.python.org/pypi/paramiko-expect/ + +.. image:: https://img.shields.io/pypi/pyversions/paramiko-expect.svg + :target: https://pypi.python.org/pypi/paramiko-expect/ + + +.. image:: https://raw.githubusercontent.com/fgimian/paramiko-expect/master/images/paramiko-expect-logo.png + :alt: Paramiko Expect Logo + +Artwork courtesy of `Open Clip Art +Library <https://openclipart.org/detail/174780/openmouthed-robot>`_ + +Introduction +------------ + +Paramiko Expect provides an expect-like extension for the Paramiko SSH library +which allows scripts to fully interact with hosts via a true SSH +connection. + +The class is constructed with an SSH Client object (this will likely be +extended to support a transport in future for more flexibility). + +Quick Start +----------- + +To install paramiko-expect, simply run the following at your prompt: + +.. code:: bash + + # from pypi + pip install paramiko-expect + + # from source + pip install git+https://github.com/fgimian/paramiko-expect.git + +So let's check out how it works in general (please see +`paramiko_expect-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo.py>`_ +for the complete code): + +.. code:: python + + # Connect to the host + client.connect(hostname=hostname, username=username, password=password) + + # Create a client interaction class which will interact with the host + interact = SSHClientInteraction(client, timeout=10, display=True) + interact.expect(prompt) + + # Run the first command and capture the cleaned output, if you want the output + # without cleaning, simply grab current_output instead. + interact.send('uname -a') + interact.expect(prompt) + cmd_output_uname = interact.current_output_clean + + # Now let's do the same for the ls command but also set a timeout for this + # specific expect (overriding the default timeout) + interact.send('ls -l /') + interact.expect(prompt, timeout=5) + cmd_output_ls = interact.current_output_clean + + # To expect multiple expressions, just use a list. You can also selectively + # take action based on what was matched. + + # Method 1: You may use the last_match property to find out what was matched + interact.send('~/paramiko_expect-demo-helper.py') + interact.expect([prompt, 'Please enter your name: ']) + if interact.last_match == 'Please enter your name: ': + interact.send('Fotis Gimian') + interact.expect(prompt) + + # Method 2: You may use the matched index to determine the last match (like pexpect) + interact.send('~/paramiko_expect-demo-helper.py') + found_index = interact.expect([prompt, 'Please enter your name: ']) + if found_index == 1: + interact.send('Fotis Gimian') + interact.expect(prompt) + + # Send the exit command and expect EOF (a closed session) + interact.send('exit') + interact.expect() + + # Print the output of each command + print '-'*79 + print 'Cleaned Command Output' + print '-'*79 + print 'uname -a output:' + print cmd_output_uname + print 'ls -l / output:' + print cmd_output_ls + +**Important**: Before running this script, be sure to place +`paramiko_expect-demo-helper.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo-helper.py>`_ +in ``~``. + +The print statements at the bottom of the script provide the following +output: + +.. code:: bash + + ------------------------------------------------------------------------------- + Cleaned Command Output + ------------------------------------------------------------------------------- + uname -a output: + Linux fotsies-ubuntu-testlab 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux + + ls -l / output: + total 77 + drwxr-xr-x 2 root root 4096 May 1 22:21 bin + drwxr-xr-x 4 root root 1024 May 1 22:22 boot + drwxr-xr-x 15 root root 4300 Jun 12 15:00 dev + drwxr-xr-x 90 root root 4096 Jun 12 16:45 etc + drwxr-xr-x 4 root root 4096 May 1 23:37 home + lrwxrwxrwx 1 root root 33 May 1 22:18 initrd.img -> /boot/initrd.img-3.2.0-23-generic + drwxr-xr-x 18 root root 4096 May 1 22:21 lib + drwxr-xr-x 2 root root 4096 May 1 22:17 lib64 + drwx------ 2 root root 16384 May 1 22:17 lost+found + drwxr-xr-x 4 root root 4096 May 1 22:18 media + drwxr-xr-x 2 root root 4096 Apr 19 19:32 mnt + drwxr-xr-x 2 root root 4096 May 1 22:17 opt + dr-xr-xr-x 84 root root 0 Jun 12 15:00 proc + drwx------ 3 root root 4096 May 30 23:32 root + drwxr-xr-x 15 root root 560 Jun 12 17:02 run + drwxr-xr-x 2 root root 4096 Jun 4 20:59 sbin + drwxr-xr-x 2 root root 4096 Mar 6 04:54 selinux + drwxr-xr-x 2 root root 4096 May 1 22:17 srv + drwxr-xr-x 13 root root 0 Jun 12 15:00 sys + drwxrwxrwt 2 root root 4096 Jun 12 16:17 tmp + drwxr-xr-x 10 root root 4096 May 1 22:17 usr + drwxr-xr-x 12 root root 4096 Jun 12 13:16 var + lrwxrwxrwx 1 root root 29 May 1 22:18 vmlinuz -> boot/vmlinuz-3.2.0-23-generic + +For interacting with tail-like scripts, we can use the tail function (please see +`paramiko_expect-tail-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-tail-demo.py>`_ +for the complete code): + +.. code:: python + + # Connect to the host + client.connect(hostname=hostname, username=username, password=password) + + # Create a client interaction class which will interact with the host + interact = SSHClientInteraction(client, timeout=10, display=False) + interact.expect(prompt) + + # Send the tail command + interact.send('tail -f /var/log/auth.log') + + # Now let the class tail the file for us + interact.tail(line_prefix=hostname+': ') + +The true power of the tail function will become more apparent when you +check out the `Multi-SSH <https://github.com/fgimian/multissh>`_ +library. Ever thought about tailing a log on multiple servers? Well +dream no more my friend, it's here! + + +Tests +----- + +Not full coverage yet, and assumes you have docker setup: + +.. code:: bash + + pip install -r requirements-test.txt + docker run -d -p 2222:22 -v `pwd`/examples:/examples -v `pwd`/test/id_rsa.pub:/root/.ssh/authorized_keys docker.io/panubo/sshd + pytest -s --cov paramiko_expect --cov-report term-missing + + +Contributions +------------- + +- Israel Fruchter (@fruch) - Tests / CI / Uploads to Pypi +- Kiseok Kim (@kiseok7) - Vagrent image + + +License +------- + +Paramiko Expect is released under the **MIT** license. Please see the +`LICENSE <https://github.com/fgimian/paramiko-expect/blob/master/LICENSE>`_ +file for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/paramiko_expect.egg-info/PKG-INFO new/paramiko-expect-0.3.4/paramiko_expect.egg-info/PKG-INFO --- old/paramiko-expect-0.3.2/paramiko_expect.egg-info/PKG-INFO 2022-01-13 13:07:35.000000000 +0100 +++ new/paramiko-expect-0.3.4/paramiko_expect.egg-info/PKG-INFO 2022-09-19 20:26:16.000000000 +0200 @@ -1,213 +1,216 @@ Metadata-Version: 2.1 Name: paramiko-expect -Version: 0.3.2 +Version: 0.3.4 Summary: An expect-like extension for the Paramiko SSH library Home-page: https://github.com/fgimian/paramiko-expect Author: Fotis Gimian Author-email: fgimiansoftw...@gmail.com License: MIT -Description: Paramiko Expect - =============== - - .. image:: https://img.shields.io/pypi/l/paramiko-expect.svg - :target: https://github.com/fgimian/paramiko-expect/blob/master/LICENSE - - .. image:: https://codecov.io/gh/fgimian/paramiko-expect/branch/master/graph/badge.svg - :target: https://codecov.io/gh/fgimian/paramiko-expect - - .. image:: https://img.shields.io/travis/fgimian/paramiko-expect.svg - :target: https://travis-ci.org/fruch/paramiko-expect/ - - .. image:: https://img.shields.io/pypi/v/paramiko-expect.svg - :target: https://pypi.python.org/pypi/paramiko-expect/ - - .. image:: https://img.shields.io/pypi/pyversions/paramiko-expect.svg - :target: https://pypi.python.org/pypi/paramiko-expect/ - - - .. image:: https://raw.githubusercontent.com/fgimian/paramiko-expect/master/images/paramiko-expect-logo.png - :alt: Paramiko Expect Logo - - Artwork courtesy of `Open Clip Art - Library <https://openclipart.org/detail/174780/openmouthed-robot>`_ - - Introduction - ------------ - - Paramiko Expect provides an expect-like extension for the Paramiko SSH library - which allows scripts to fully interact with hosts via a true SSH - connection. - - The class is constructed with an SSH Client object (this will likely be - extended to support a transport in future for more flexibility). - - Quick Start - ----------- - - To install paramiko-expect, simply run the following at your prompt: - - .. code:: bash - - # from pypi - pip install paramiko-expect - - # from source - pip install git+https://github.com/fgimian/paramiko-expect.git - - So let's check out how it works in general (please see - `paramiko_expect-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo.py>`_ - for the complete code): - - .. code:: python - - # Connect to the host - client.connect(hostname=hostname, username=username, password=password) - - # Create a client interaction class which will interact with the host - interact = SSHClientInteraction(client, timeout=10, display=True) - interact.expect(prompt) - - # Run the first command and capture the cleaned output, if you want the output - # without cleaning, simply grab current_output instead. - interact.send('uname -a') - interact.expect(prompt) - cmd_output_uname = interact.current_output_clean - - # Now let's do the same for the ls command but also set a timeout for this - # specific expect (overriding the default timeout) - interact.send('ls -l /') - interact.expect(prompt, timeout=5) - cmd_output_ls = interact.current_output_clean - - # To expect multiple expressions, just use a list. You can also selectively - # take action based on what was matched. - - # Method 1: You may use the last_match property to find out what was matched - interact.send('~/paramiko_expect-demo-helper.py') - interact.expect([prompt, 'Please enter your name: ']) - if interact.last_match == 'Please enter your name: ': - interact.send('Fotis Gimian') - interact.expect(prompt) - - # Method 2: You may use the matched index to determine the last match (like pexpect) - interact.send('~/paramiko_expect-demo-helper.py') - found_index = interact.expect([prompt, 'Please enter your name: ']) - if found_index == 1: - interact.send('Fotis Gimian') - interact.expect(prompt) - - # Send the exit command and expect EOF (a closed session) - interact.send('exit') - interact.expect() - - # Print the output of each command - print '-'*79 - print 'Cleaned Command Output' - print '-'*79 - print 'uname -a output:' - print cmd_output_uname - print 'ls -l / output:' - print cmd_output_ls - - **Important**: Before running this script, be sure to place - `paramiko_expect-demo-helper.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo-helper.py>`_ - in ``~``. - - The print statements at the bottom of the script provide the following - output: - - .. code:: bash - - ------------------------------------------------------------------------------- - Cleaned Command Output - ------------------------------------------------------------------------------- - uname -a output: - Linux fotsies-ubuntu-testlab 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux - - ls -l / output: - total 77 - drwxr-xr-x 2 root root 4096 May 1 22:21 bin - drwxr-xr-x 4 root root 1024 May 1 22:22 boot - drwxr-xr-x 15 root root 4300 Jun 12 15:00 dev - drwxr-xr-x 90 root root 4096 Jun 12 16:45 etc - drwxr-xr-x 4 root root 4096 May 1 23:37 home - lrwxrwxrwx 1 root root 33 May 1 22:18 initrd.img -> /boot/initrd.img-3.2.0-23-generic - drwxr-xr-x 18 root root 4096 May 1 22:21 lib - drwxr-xr-x 2 root root 4096 May 1 22:17 lib64 - drwx------ 2 root root 16384 May 1 22:17 lost+found - drwxr-xr-x 4 root root 4096 May 1 22:18 media - drwxr-xr-x 2 root root 4096 Apr 19 19:32 mnt - drwxr-xr-x 2 root root 4096 May 1 22:17 opt - dr-xr-xr-x 84 root root 0 Jun 12 15:00 proc - drwx------ 3 root root 4096 May 30 23:32 root - drwxr-xr-x 15 root root 560 Jun 12 17:02 run - drwxr-xr-x 2 root root 4096 Jun 4 20:59 sbin - drwxr-xr-x 2 root root 4096 Mar 6 04:54 selinux - drwxr-xr-x 2 root root 4096 May 1 22:17 srv - drwxr-xr-x 13 root root 0 Jun 12 15:00 sys - drwxrwxrwt 2 root root 4096 Jun 12 16:17 tmp - drwxr-xr-x 10 root root 4096 May 1 22:17 usr - drwxr-xr-x 12 root root 4096 Jun 12 13:16 var - lrwxrwxrwx 1 root root 29 May 1 22:18 vmlinuz -> boot/vmlinuz-3.2.0-23-generic - - For interacting with tail-like scripts, we can use the tail function (please see - `paramiko_expect-tail-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-tail-demo.py>`_ - for the complete code): - - .. code:: python - - # Connect to the host - client.connect(hostname=hostname, username=username, password=password) - - # Create a client interaction class which will interact with the host - interact = SSHClientInteraction(client, timeout=10, display=False) - interact.expect(prompt) - - # Send the tail command - interact.send('tail -f /var/log/auth.log') - - # Now let the class tail the file for us - interact.tail(line_prefix=hostname+': ') - - The true power of the tail function will become more apparent when you - check out the `Multi-SSH <https://github.com/fgimian/multissh>`_ - library. Ever thought about tailing a log on multiple servers? Well - dream no more my friend, it's here! - - - Tests - ----- - - Not full coverage yet, and assumes you have docker setup: - - .. code:: bash - - pip install -r requirements-test.txt - docker run -d -p 2222:22 -v `pwd`/examples:/examples -v `pwd`/test/id_rsa.pub:/root/.ssh/authorized_keys docker.io/panubo/sshd - pytest -s --cov paramiko_expect --cov-report term-missing - - - Contributions - ------------- - - - Israel Fruchter (@fruch) - Tests / CI / Uploads to Pypi - - Kiseok Kim (@kiseok7) - Vagrent image - - - License - ------- - - Paramiko Expect is released under the **MIT** license. Please see the - `LICENSE <https://github.com/fgimian/paramiko-expect/blob/master/LICENSE>`_ - file for more details. - Platform: Posix Classifier: Development Status :: 4 - Beta Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Intended Audience :: Developers Description-Content-Type: text/x-rst +License-File: LICENSE + +Paramiko Expect +=============== + +.. image:: https://img.shields.io/pypi/l/paramiko-expect.svg + :target: https://github.com/fgimian/paramiko-expect/blob/master/LICENSE + +.. image:: https://codecov.io/gh/fgimian/paramiko-expect/branch/master/graph/badge.svg + :target: https://codecov.io/gh/fgimian/paramiko-expect + +.. image:: https://img.shields.io/travis/fgimian/paramiko-expect.svg + :target: https://travis-ci.org/fruch/paramiko-expect/ + +.. image:: https://img.shields.io/pypi/v/paramiko-expect.svg + :target: https://pypi.python.org/pypi/paramiko-expect/ + +.. image:: https://img.shields.io/pypi/pyversions/paramiko-expect.svg + :target: https://pypi.python.org/pypi/paramiko-expect/ + + +.. image:: https://raw.githubusercontent.com/fgimian/paramiko-expect/master/images/paramiko-expect-logo.png + :alt: Paramiko Expect Logo + +Artwork courtesy of `Open Clip Art +Library <https://openclipart.org/detail/174780/openmouthed-robot>`_ + +Introduction +------------ + +Paramiko Expect provides an expect-like extension for the Paramiko SSH library +which allows scripts to fully interact with hosts via a true SSH +connection. + +The class is constructed with an SSH Client object (this will likely be +extended to support a transport in future for more flexibility). + +Quick Start +----------- + +To install paramiko-expect, simply run the following at your prompt: + +.. code:: bash + + # from pypi + pip install paramiko-expect + + # from source + pip install git+https://github.com/fgimian/paramiko-expect.git + +So let's check out how it works in general (please see +`paramiko_expect-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo.py>`_ +for the complete code): + +.. code:: python + + # Connect to the host + client.connect(hostname=hostname, username=username, password=password) + + # Create a client interaction class which will interact with the host + interact = SSHClientInteraction(client, timeout=10, display=True) + interact.expect(prompt) + + # Run the first command and capture the cleaned output, if you want the output + # without cleaning, simply grab current_output instead. + interact.send('uname -a') + interact.expect(prompt) + cmd_output_uname = interact.current_output_clean + + # Now let's do the same for the ls command but also set a timeout for this + # specific expect (overriding the default timeout) + interact.send('ls -l /') + interact.expect(prompt, timeout=5) + cmd_output_ls = interact.current_output_clean + + # To expect multiple expressions, just use a list. You can also selectively + # take action based on what was matched. + + # Method 1: You may use the last_match property to find out what was matched + interact.send('~/paramiko_expect-demo-helper.py') + interact.expect([prompt, 'Please enter your name: ']) + if interact.last_match == 'Please enter your name: ': + interact.send('Fotis Gimian') + interact.expect(prompt) + + # Method 2: You may use the matched index to determine the last match (like pexpect) + interact.send('~/paramiko_expect-demo-helper.py') + found_index = interact.expect([prompt, 'Please enter your name: ']) + if found_index == 1: + interact.send('Fotis Gimian') + interact.expect(prompt) + + # Send the exit command and expect EOF (a closed session) + interact.send('exit') + interact.expect() + + # Print the output of each command + print '-'*79 + print 'Cleaned Command Output' + print '-'*79 + print 'uname -a output:' + print cmd_output_uname + print 'ls -l / output:' + print cmd_output_ls + +**Important**: Before running this script, be sure to place +`paramiko_expect-demo-helper.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-demo-helper.py>`_ +in ``~``. + +The print statements at the bottom of the script provide the following +output: + +.. code:: bash + + ------------------------------------------------------------------------------- + Cleaned Command Output + ------------------------------------------------------------------------------- + uname -a output: + Linux fotsies-ubuntu-testlab 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux + + ls -l / output: + total 77 + drwxr-xr-x 2 root root 4096 May 1 22:21 bin + drwxr-xr-x 4 root root 1024 May 1 22:22 boot + drwxr-xr-x 15 root root 4300 Jun 12 15:00 dev + drwxr-xr-x 90 root root 4096 Jun 12 16:45 etc + drwxr-xr-x 4 root root 4096 May 1 23:37 home + lrwxrwxrwx 1 root root 33 May 1 22:18 initrd.img -> /boot/initrd.img-3.2.0-23-generic + drwxr-xr-x 18 root root 4096 May 1 22:21 lib + drwxr-xr-x 2 root root 4096 May 1 22:17 lib64 + drwx------ 2 root root 16384 May 1 22:17 lost+found + drwxr-xr-x 4 root root 4096 May 1 22:18 media + drwxr-xr-x 2 root root 4096 Apr 19 19:32 mnt + drwxr-xr-x 2 root root 4096 May 1 22:17 opt + dr-xr-xr-x 84 root root 0 Jun 12 15:00 proc + drwx------ 3 root root 4096 May 30 23:32 root + drwxr-xr-x 15 root root 560 Jun 12 17:02 run + drwxr-xr-x 2 root root 4096 Jun 4 20:59 sbin + drwxr-xr-x 2 root root 4096 Mar 6 04:54 selinux + drwxr-xr-x 2 root root 4096 May 1 22:17 srv + drwxr-xr-x 13 root root 0 Jun 12 15:00 sys + drwxrwxrwt 2 root root 4096 Jun 12 16:17 tmp + drwxr-xr-x 10 root root 4096 May 1 22:17 usr + drwxr-xr-x 12 root root 4096 Jun 12 13:16 var + lrwxrwxrwx 1 root root 29 May 1 22:18 vmlinuz -> boot/vmlinuz-3.2.0-23-generic + +For interacting with tail-like scripts, we can use the tail function (please see +`paramiko_expect-tail-demo.py <https://github.com/fgimian/paramiko-expect/blob/master/examples/paramiko_expect-tail-demo.py>`_ +for the complete code): + +.. code:: python + + # Connect to the host + client.connect(hostname=hostname, username=username, password=password) + + # Create a client interaction class which will interact with the host + interact = SSHClientInteraction(client, timeout=10, display=False) + interact.expect(prompt) + + # Send the tail command + interact.send('tail -f /var/log/auth.log') + + # Now let the class tail the file for us + interact.tail(line_prefix=hostname+': ') + +The true power of the tail function will become more apparent when you +check out the `Multi-SSH <https://github.com/fgimian/multissh>`_ +library. Ever thought about tailing a log on multiple servers? Well +dream no more my friend, it's here! + + +Tests +----- + +Not full coverage yet, and assumes you have docker setup: + +.. code:: bash + + pip install -r requirements-test.txt + docker run -d -p 2222:22 -v `pwd`/examples:/examples -v `pwd`/test/id_rsa.pub:/root/.ssh/authorized_keys docker.io/panubo/sshd + pytest -s --cov paramiko_expect --cov-report term-missing + + +Contributions +------------- + +- Israel Fruchter (@fruch) - Tests / CI / Uploads to Pypi +- Kiseok Kim (@kiseok7) - Vagrent image + + +License +------- + +Paramiko Expect is released under the **MIT** license. Please see the +`LICENSE <https://github.com/fgimian/paramiko-expect/blob/master/LICENSE>`_ +file for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/paramiko_expect.egg-info/SOURCES.txt new/paramiko-expect-0.3.4/paramiko_expect.egg-info/SOURCES.txt --- old/paramiko-expect-0.3.2/paramiko_expect.egg-info/SOURCES.txt 2022-01-13 13:07:35.000000000 +0100 +++ new/paramiko-expect-0.3.4/paramiko_expect.egg-info/SOURCES.txt 2022-09-19 20:26:16.000000000 +0200 @@ -1,3 +1,4 @@ +LICENSE README.rst paramiko_expect.py setup.cfg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/paramiko_expect.py new/paramiko-expect-0.3.4/paramiko_expect.py --- old/paramiko-expect-0.3.2/paramiko_expect.py 2021-12-14 15:03:04.000000000 +0100 +++ new/paramiko-expect-0.3.4/paramiko_expect.py 2022-09-19 20:21:34.000000000 +0200 @@ -35,7 +35,7 @@ def strip_ansi_codes(s): - return re.sub(r'\x1b\[([0-9,A-Z]{1,2}(;[0-9]{1,2})?(;[0-9]{3})?)?[m|K]?', '', s) + return re.sub(r'\x1b\[([0-9,A-Z]{1,2}(;[0-9]{1,2})?(;[0-9]{3})?)?[m|K]?|\?(1049|2004)[hl]', '', s) def default_output_func(msg): @@ -168,7 +168,7 @@ ): current_buffer_output_decoded = '' # avoids paramiko hang when recv is not ready yet - while not self.channel.recv_ready(): + while not self.channel.closed and not self.channel.recv_ready(): time.sleep(.009) if time.time() >= (base_time + timeout): print('EXCESS TIME RECV_READY TIMEOUT, did you expect() before a send()') @@ -368,6 +368,10 @@ # Restore the attributes of the shell you were in termios.tcsetattr(sys.stdin, termios.TCSADRAIN, original_tty) else: + # We must set the timeout to None so that we can bypass times when + # there is no available text to receive + self.channel.settimeout(None) + def writeall(sock): while True: buffer = sock.recv(self.buffer_size) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/setup.py new/paramiko-expect-0.3.4/setup.py --- old/paramiko-expect-0.3.2/setup.py 2022-01-13 13:07:25.000000000 +0100 +++ new/paramiko-expect-0.3.4/setup.py 2022-09-19 20:22:14.000000000 +0200 @@ -8,7 +8,7 @@ setup( name='paramiko-expect', - version='0.3.2', + version='0.3.4', url='https://github.com/fgimian/paramiko-expect', license='MIT', author='Fotis Gimian', @@ -24,10 +24,12 @@ classifiers=[ 'Development Status :: 4 - Beta', 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: PyPy', 'Intended Audience :: Developers' ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/paramiko-expect-0.3.2/test/test_paramiko_expect.py new/paramiko-expect-0.3.4/test/test_paramiko_expect.py --- old/paramiko-expect-0.3.2/test/test_paramiko_expect.py 2022-01-13 13:07:25.000000000 +0100 +++ new/paramiko-expect-0.3.4/test/test_paramiko_expect.py 2022-09-19 20:21:34.000000000 +0200 @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import socket +import logging import pytest try: @@ -17,17 +18,27 @@ except ImportError: from contextlib2 import ExitStack +from ssh import SshContainer + prompt = ".*:~#.*" +@pytest.fixture(scope="session") +def docker_ssh(): + with SshContainer() as container: + print(container._container.logs().decode()) + yield container + + @pytest.fixture(scope="module") -def interact(request): +def interact(request, docker_ssh): # Create a new SSH client object client = paramiko.SSHClient() # Set SSH key parameters to auto accept unknown hosts client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # Connect to the host - client.connect(hostname="localhost", username="root", port=2222, key_filename='./test/id_rsa') + hostname, port = docker_ssh.get_address() + client.connect(hostname=hostname, username="root", port=port, key_filename='./test/id_rsa') # Create a client interaction class which will interact with the host interact = SSHClientInteraction(client, timeout=10, display=True) @@ -103,10 +114,11 @@ interact.tail(line_prefix="test:", callback=lambda p, m: "", stop_callback=stop_callback) -def test_05_context(): +def test_05_context(docker_ssh): client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - client.connect(hostname="localhost", username="root", port=2222, key_filename='./test/id_rsa') + hostname, port = docker_ssh.get_address() + client.connect(hostname=hostname, username="root", port=port, key_filename='./test/id_rsa') with SSHClientInteraction(client, timeout=10, display=True) as interact: interact.send('ls -all /') interact.expect(prompt, timeout=120) @@ -224,10 +236,11 @@ interact.close() -def test_08_issue_25_skip_newline(): +def test_08_issue_25_skip_newline(docker_ssh): client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - client.connect(hostname="localhost", username="root", port=2222, key_filename='./test/id_rsa') + hostname, port = docker_ssh.get_address() + client.connect(hostname=hostname, username="root", port=port, key_filename='./test/id_rsa') with SSHClientInteraction(client, timeout=10, display=True) as interact: interact.send('ls -all') interact.expect(prompt, timeout=5) @@ -241,5 +254,6 @@ interact.send('ls -all') interact.expect(prompt, timeout=5) + def test_09_utf8(interact): interact.send(u'Andr??')