class Object

Public Instance Methods

NexposeLogin(consoleIP) click to toggle source

Log into a Nexpose console. Returns a connection object.

@param consoleIP [String] the IP address of the Nexpose console. @return [Connection] the connection object.

# File lib/nexpose-functions.rb, line 8
def NexposeLogin(consoleIP)
    require "io/console"

    print "Username: "
    username = $stdin.gets.chomp
    print "Password: "
    password = STDIN.noecho(&:gets).chomp
    puts ""

    # Blank the proxy variables so they won't be used to connect to the Console.
    ENV['http_proxy'] = nil
    ENV['https_proxy'] = nil
    
    # Create connection and login.
    nsc = Nexpose::Connection.new(consoleIP, username, password)
    nsc.login
    return nsc
end