Skip to content

Getting started on Ubuntu

tanisdeluna edited this page Apr 3, 2015 · 8 revisions

Install Ruby

NOTE: Ruby requirements will change with nexpose-client version 1.0.0

There are 2 typical methods to install Ruby on Ubuntu. Selecting one is up to personal preference, but some options provide more recent Ruby versions. The following assumes you are using a non-root terminal. Nexpose gem requires at least Ruby 1.9.3 and is known to work on Ruby 2.0.0 and Ruby 2.1.0.

Install from Ubuntu repositories

  1. Run sudo apt-get update to get the latest package listing
  2. Run sudo apt-get install ruby1.9.1-full to install Ruby 1.9.3
  3. Check the Ruby version with ruby --version

Install with RVM

The simplest way to install Ruby with RVM is to run the following command, as a non-root user and without sudo:

  1. \curl -sSL https://get.rvm.io | bash -s stable --ruby
  2. Check the Ruby version with ruby --version

As of this writing, the above command will install the latest release of Ruby 2.1.0

For more information on RVM installation see http://rvm.io/rvm/install

Install the Nexpose gem

  1. Enter the following command: gem install nexpose --no-ri --no-rdoc
  • The no-ri and no-rdoc options reduce download size for the Rex dependencies
  • If you get a permission denied error, you might need to source the RVM script with "source ~/.rvm/scripts/rvm"
  1. Check the Nexpose gem version installed: gem list | grep nexpose

Log in to Nexpose using irb

  1. In your terminal run irb to launch the Ruby interpreter
  2. Enter the following lines to load the Nexpose gem and setup a connection to a Nexpose Security Console
require 'nexpose'

nsc = Nexpose::Connection.new('localhost', 'nxadmin', 'nxpassword')

Note: Be sure to set the correct hostname or IP address, username, and password for your Nexpose Security Console.

Enter the following lines to log in to Nexpose and list all sites

nsc.login

nsc.list_sites

When you're finished interacting with a Nexpose session, you should log out to ensure the session is freed up

nsc.logout

exit