metasploit-framework/lib/net/ssh
HD Moore c2a71d63b4 Tweak the logic here 2012-01-06 00:53:50 -06:00
..
authentication Tweak the logic here 2012-01-06 00:53:50 -06:00
connection Fixes #3625 by replacing with proper calls to create Rex sockets. 2011-01-31 16:47:51 +00:00
proxy Fixes #3625 by replacing with proper calls to create Rex sockets. 2011-01-31 16:47:51 +00:00
service Missed a session.options. 2011-12-29 08:59:16 -06:00
test See #842. Convering TCPSocket calls to Rex::Socket::Tcp calls. 2010-02-16 22:49:27 +00:00
transport Sync with upstream, add compatibility to rc4 algorithms (solaris support) 2011-06-10 02:02:18 +00:00
verifiers Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
CHANGELOG.rdoc Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
README.rdoc Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
THANKS.rdoc Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
buffer.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
buffered_io.rb Fixes #3625 by replacing with proper calls to create Rex sockets. 2011-01-31 16:47:51 +00:00
command_stream.rb read() instead of sysread(), fixes ssh sessions 2011-05-02 00:23:42 +00:00
config.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
errors.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
key_factory.rb Fixes #2133. This seems to handle many keyfiles pretty well, even if they're concatenated together. Calling it closed. 2010-06-24 01:00:08 +00:00
known_hosts.rb Removing net-ssh's ability to write to your known_hosts file. Some day, make this an optional behavior, but for now, turn that rudeness off. 2010-02-26 22:45:58 +00:00
loggable.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
packet.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
prompt.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
ruby_compat.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
test.rb Fixes #841. Initial commit for net-ssh by Jamis Buck. http://github.com/jamis/net-ssh 2010-02-16 19:18:19 +00:00
utils.rb Force binmode for Tempfile use to prevent issues with Windows 2010-10-12 01:48:42 +00:00
utils.rb.ut.rb Adds an easily-accessable fingerprint method to identify public and private ssh keys. 2010-04-21 16:36:07 +00:00
version.rb Sync with upstream, add compatibility to rc4 algorithms (solaris support) 2011-06-10 02:02:18 +00:00

README.rdoc

= Net::SSH

* http://net-ssh.rubyforge.org/ssh

== DESCRIPTION:

Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2.

== FEATURES:

* Execute processes on remote servers and capture their output
* Run multiple processes in parallel over a single SSH connection
* Support for SSH subsystems
* Forward local and remote ports via an SSH connection

== SYNOPSIS:

In a nutshell:

  require 'net/ssh'

  Net::SSH.start('host', 'user', :password => "password") do |ssh|
    # capture all stderr and stdout output from a remote process
    output = ssh.exec!("hostname")

    # capture only stdout matching a particular pattern
    stdout = ""
    ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
      stdout << data if stream == :stdout
    end
    puts stdout

    # run multiple processes in parallel to completion
    ssh.exec "sed ..."
    ssh.exec "awk ..."
    ssh.exec "rm -rf ..."
    ssh.loop

    # open a new channel and configure a minimal set of callbacks, then run
    # the event loop until the channel finishes (closes)
    channel = ssh.open_channel do |ch|
      ch.exec "/usr/local/bin/ruby /path/to/file.rb" do |ch, success|
        raise "could not execute command" unless success

        # "on_data" is called when the process writes something to stdout
        ch.on_data do |c, data|
          $STDOUT.print data
        end

        # "on_extended_data" is called when the process writes something to stderr
        ch.on_extended_data do |c, type, data|
          $STDERR.print data
        end

        ch.on_close { puts "done!" }
      end
    end

    channel.wait

    # forward connections on local port 1234 to port 80 of www.capify.org
    ssh.forward.local(1234, "www.capify.org", 80)
    ssh.loop { true }
  end

See Net::SSH for more documentation, and links to further information.

== REQUIREMENTS:

The only requirement you might be missing is the OpenSSL bindings for Ruby. These are built by default on most platforms, but you can verify that they're built and installed on your system by running the following command line:

  ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'

If that spits out something like "OpenSSL 0.9.8g 19 Oct 2007", then you're set. If you get an error, then you'll need to see about rebuilding ruby with OpenSSL support, or (if your platform supports it) installing the OpenSSL bindings separately.

Additionally: if you are going to be having Net::SSH prompt you for things like passwords or certificate passphrases, you'll want to have either the Highline (recommended) or Termios (unix systems only) gem installed, so that the passwords don't echo in clear text.

Lastly, if you want to run the tests or use any of the Rake tasks, you'll need:

* Echoe (for the Rakefile)
* Mocha (for the tests)

== INSTALL:

* gem install net-ssh (might need sudo privileges)

== LICENSE:

(The MIT License)

Copyright (c) 2008 Jamis Buck <jamis@37signals.com>

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.