Skip to content

Commit

Permalink
include the gem contents
Browse files Browse the repository at this point in the history
  • Loading branch information
HD Moore committed Oct 21, 2011
1 parent 47947da commit bcd5e91
Show file tree
Hide file tree
Showing 8 changed files with 5,212 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Nexpose

This is the official gem package for the Ruby NeXpose API included in the Metasploit Framework. This version is based on SVN revision 12430.
The upstream for this gem can be found at https://metasploit.com/svn/framework3/trunk/lib/rapid7

# Credits
Rapid7 LLC
22 changes: 22 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# encoding: utf-8

task :build => :update do
Rake::Task['clean'].execute
puts "[*] Building nexpose.gemspec"
system "gem build nexpose.gemspec &> /dev/null"
end

task :release => :build do
puts "[*] Pushing nexpose to rubygems.org"
system "gem push nexpose-*.gem &> /dev/null"
Rake::Task['clean'].execute
end

task :clean do
system "rm *.gem &> /dev/null"
end

task :update do
system "rm -f lib/nexpose.rb"
system "svn export https://metasploit.com/svn/framework3/trunk/lib/rapid7/nexpose.rb lib/nexpose.rb"
end
35 changes: 35 additions & 0 deletions examples/nexpose_console.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'nexpose'

require 'pp'

#
# Change these to point to your instance/user/password
#
host = "127.0.0.1"
port = "3790"
user = "nxadmin"
pass = "nxadmin"

#
# Connect and authenticate
#
begin

# Create a connection to the NeXpose instance
@nsc = Nexpose::Connection.new(host, user, pass, port)

# Authenticate to this instance (throws an exception if this fails)
@nsc.login

rescue ::Nexpose::APIError => e
$stderr.puts ("Connection failed: #{e.reason}")
exit(1)
end

#
# Query the version through the NeXpose console interface
#
res = @nsc.console_command("ver")
pp res
42 changes: 42 additions & 0 deletions examples/nexpose_sites.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'nexpose'

require 'pp'

#
# Change these to point to your instance/user/password
#
host = "127.0.0.1"
port = "3790"
user = "nxadmin"
pass = "nxadmin"

#
# Connect and authenticate
#
begin

# Create a connection to the NeXpose instance
@nsc = Nexpose::Connection.new(host, user, pass, port)

# Authenticate to this instance (throws an exception if this fails)
@nsc.login

rescue ::Nexpose::APIError => e
$stderr.puts ("Connection failed: #{e.reason}")
exit(1)
end

#
# Query a list of all NeXpose sites and display them
#
sites = @nsc.site_listing || []
case sites.length
when 0
puts("There are currently no active sites on this NeXpose instance")
end

sites.each do |site|
puts(" Site ##{site[:site_id]} '#{site[:name]}' Risk Factor: #{site[:risk_factor]} Risk Score: #{site[:risk_score]}")
end
35 changes: 35 additions & 0 deletions examples/nexpose_sysinfo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'nexpose'

require 'pp'

#
# Change these to point to your instance/user/password
#
host = "127.0.0.1"
port = "3790"
user = "nxadmin"
pass = "nxadmin"

#
# Connect and authenticate
#
begin

# Create a connection to the NeXpose instance
@nsc = Nexpose::Connection.new(host, user, pass, port)

# Authenticate to this instance (throws an exception if this fails)
@nsc.login

rescue ::Nexpose::APIError => e
$stderr.puts ("Connection failed: #{e.reason}")
exit(1)
end

#
# Query system parameters and display them
#
res = @nsc.system_information
pp res
Loading

0 comments on commit bcd5e91

Please sign in to comment.