
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
robotframework-sshlibrary
Advanced tools
.. contents::
SSHLibrary_ is a Robot Framework
_ test
library for SSH and SFTP. The project is hosted on GitHub_
and downloads can be found from PyPI_.
SSHLibrary is operating system independent and supports Python 2.7 as well
as Python 3.4 or newer. In addition to the normal Python_ interpreter,
it also works with Jython 2.7
_.
The library has the following main usages:
.. image:: https://img.shields.io/pypi/l/robotframework-sshlibrary.svg :target: http://www.apache.org/licenses/LICENSE-2.0
.. image:: https://api.travis-ci.org/robotframework/SSHLibrary.png :target: http://travis-ci.org/robotframework/SSHLibrary
See keyword documentation
_ for available keywords and more information
about the library in general.
For general information about using test libraries with Robot Framework, see
Robot Framework User Guide
_.
The recommended installation method is using pip_::
pip install --upgrade robotframework-sshlibrary
Running this command installs also the latest Robot Framework, paramiko_
and scp_ versions. The minimum supported paramiko version is 1.15.3
and
minimum supported scp version is 0.13.0
.
The --upgrade
option can be omitted when installing the library for the
first time.
With recent versions of pip
it is possible to install directly from the
GitHub_ repository. To install latest source from the master branch, use
this command::
pip install git+https://github.com/robotframework/SSHLibrary.git
Alternatively you can download the source distribution from PyPI_, extract it, and install it using one of the following depending are you using Python or Jython::
python setup.py install
jython setup.py install
A benefit of using pip is that it automatically installs scp, paramiko and Cryptography_ modules (or PyCrypto_ if paramiko version < 2.0) that SSHLibrary requires on Python.
On Jython, SSHLibrary requires Trilead SSH JAR distribution. You need to download
Trilead SSH JAR distribution
_ and add it to CLASSPATH.
On Windows operating system, when using Python version < 3.0, SSHLibrary will
require win_inet_pton_. The minimum supported win_inet_pton version is 1.1.0
.
For creating SSH tunnels robotbackgroundlogger_ > 1.2 is also a requirement.
Docker
When installing SSHLibrary in a container (eg. Alpine Linux) there are more dependencies
that must be installed: gcc_, make_, openssl-dev_, musl-dev_ and libffi-dev_. These
packages can be installed using::
apk add gcc make openssl-dev musl-dev libffi-dev
Usage
-----
To use SSHLibrary in Robot Framework tests, the library needs to first be
imported using the Library setting as any other library.
When using Robot Framework, it is generally recommended to write as
easy-to-understand tests as possible. The keywords provided by
SSHLibrary are pretty low level and it is typically a good idea to
write tests using Robot Framework's higher level keywords that utilize
SSHLibrary keywords internally. This is illustrated by the following example
where SSHLibrary keywords like ``Open Connection`` and ``Login`` are grouped
together in a higher level keyword like ``Open Connection And Log In``.
.. code:: robotframework
*** Settings ***
Documentation This example demonstrates executing a command on a remote machine
... and getting its output.
...
... Notice how connections are handled as part of the suite setup and
... teardown. This saves some time when executing several test cases.
Library SSHLibrary
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
*** Variables ***
${HOST} localhost
${USERNAME} test
${PASSWORD} test
*** Test Cases ***
Execute Command And Verify Output
[Documentation] Execute Command can be used to run commands on the remote machine.
... The keyword returns the standard output by default.
${output}= Execute Command echo Hello SSHLibrary!
Should Be Equal ${output} Hello SSHLibrary!
*** Keywords ***
Open Connection And Log In
Open Connection ${HOST}
Login ${USERNAME} ${PASSWORD}
Support
-------
If the provided documentation is not enough, there are various support forums
available:
- `robotframework-users`_ mailing list
- ``#sshlibrary`` and ``#sshlibrary-dev`` channels in
Robot Framework `Slack community`_
- SSHLibrary `issue tracker`_ for bug reports and concrete enhancement
requests
- `Other support forums`_ including paid support
.. _Robot Framework: http://robotframework.org
.. _Robot Framework User Guide: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-test-libraries
.. _SSHLibrary: https://github.com/robotframework/SSHLibrary
.. _GitHub: https://github.com/robotframework/SSHLibrary
.. _Python: http://python.org
.. _pip: http://pip-installer.org
.. _PyPI: https://pypi.python.org/pypi/robotframework-sshlibrary
.. _Keyword Documentation: http://robotframework.org/SSHLibrary/SSHLibrary.html
.. _Jython 2.7: http://jython.org
.. _paramiko: http://www.paramiko.org
.. _scp: https://github.com/jbardin/scp.py
.. _Cryptography: https://cryptography.io
.. _PyCrypto: http://www.pycrypto.org
.. _Trilead SSH JAR distribution: http://search.maven.org/remotecontent?filepath=com/trilead/trilead-ssh2/1.0.0-build221/trilead-ssh2-1.0.0-build221.jar
.. _win_inet_pton: https://github.com/hickeroar/win_inet_pton
.. _robotbackgroundlogger: https://github.com/robotframework/robotbackgroundlogger
.. _gcc: https://pkgs.alpinelinux.org/packages?name=gcc&branch=edge
.. _make: https://pkgs.alpinelinux.org/packages?name=make&branch=edge
.. _openssl-dev: https://pkgs.alpinelinux.org/packages?name=openssl-dev&branch=edge
.. _musl-dev: https://pkgs.alpinelinux.org/packages?name=musl-dev&branch=edge
.. _libffi-dev: https://pkgs.alpinelinux.org/packages?name=libffi-dev&branch=edge
.. _robotframework-users: http://groups.google.com/group/robotframework-users
.. _Slack community: https://robotframework-slack-invite.herokuapp.com
.. _issue tracker: https://github.com/robotframework/SSHLibrary/issues
.. _Other support forums: http://robotframework.org/#support
FAQs
Robot Framework test library for SSH and SFTP
We found that robotframework-sshlibrary demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.