-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
HD Moore
committed
Oct 21, 2011
1 parent
47947da
commit bcd5e91
Showing
8 changed files
with
5,212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.