nexpose-security-console 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +2 -0
- data/Guardfile +54 -0
- data/README.adoc +126 -0
- data/README.rdoc +6 -0
- data/Rakefile +51 -0
- data/bin/console +11 -0
- data/bin/setup +10 -0
- data/exe/nsc +89 -0
- data/lib/nexpose-security-console.rb +5 -0
- data/lib/nexpose-security-console/version.rb +3 -0
- data/nexpose-security-console.gemspec +69 -0
- data/nexpose-security-console.rdoc +5 -0
- data/results.html +473 -0
- metadata +321 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 726e8181f2328a6e9a6b707e820f8e7fff4c69fd
|
4
|
+
data.tar.gz: 38b349ab29b97b32ace3affc8f29e691227c9971
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 352ec6620e0bfc945b6cb05b7d7c90f7c238b641e2dd438983a52b8c8bb4b770c9401982038db6340777a8da266acf3d418cdb286625c2d251229894a57bb838
|
7
|
+
data.tar.gz: 402485d1b7002b8582d5837ba109ca5f5efaf7171e140736ba0a648a57ece4d140afc66a9925c955a585fdcd6e75410c1e11c2cdfbd2ff11df297806ceb85ea6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :minitest do
|
19
|
+
# with Minitest::Unit
|
20
|
+
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
21
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
22
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
23
|
+
|
24
|
+
# with Minitest::Spec
|
25
|
+
# watch(%r{^spec/(.*)_spec\.rb$})
|
26
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
27
|
+
# watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
28
|
+
|
29
|
+
# Rails 4
|
30
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
31
|
+
# watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
|
32
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
|
33
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
34
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
|
35
|
+
# watch(%r{^test/.+_test\.rb$})
|
36
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
37
|
+
|
38
|
+
# Rails < 4
|
39
|
+
# watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
40
|
+
# watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
41
|
+
# watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
42
|
+
end
|
43
|
+
|
44
|
+
guard :bundler do
|
45
|
+
require 'guard/bundler'
|
46
|
+
require 'guard/bundler/verify'
|
47
|
+
helper = Guard::Bundler::Verify.new
|
48
|
+
|
49
|
+
files = ['Gemfile']
|
50
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
51
|
+
|
52
|
+
# Assume files are symlinked from somewhere
|
53
|
+
files.each { |file| watch(helper.real_path(file)) }
|
54
|
+
end
|
data/README.adoc
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
= Nexpose Security Console
|
2
|
+
Christian Kyony <ckyony@changamuka.com>
|
3
|
+
v0.0.1, 3 February 2017
|
4
|
+
|
5
|
+
|
6
|
+
For security engineers
|
7
|
+
who needs to interact with a Rapid7 Nexpose console,
|
8
|
+
the *nexpose-security-console* gem is a Git like command line utility
|
9
|
+
that provides the ability to:
|
10
|
+
|
11
|
+
- create a new site,
|
12
|
+
- add an IP to the site,
|
13
|
+
- perform a scan against the site usinsc a defined/passed scan template,
|
14
|
+
- produce a reports for vulnerabilitie0s, installed software, and policy compliance.
|
15
|
+
- to delete in bulk more than 1000 assets in a given site
|
16
|
+
- etc
|
17
|
+
|
18
|
+
Unlike the Nexposecli gem and other alternatives,
|
19
|
+
*nexpose-security-consolei* is designed as command suite a la GIT.
|
20
|
+
|
21
|
+
|
22
|
+
== Personal scratch
|
23
|
+
|
24
|
+
I need to delete ~ 100 thousands assets from a group asset.
|
25
|
+
The web GUI only allows to delete 500 at a time.
|
26
|
+
Hence, nexpose-security-console was born.
|
27
|
+
|
28
|
+
|
29
|
+
== Installation
|
30
|
+
|
31
|
+
=== From Rubygems
|
32
|
+
|
33
|
+
----
|
34
|
+
$ gem install nexpose-security-console
|
35
|
+
----
|
36
|
+
|
37
|
+
=== From source code
|
38
|
+
|
39
|
+
- If you have access to the Internet, obtain the source code from Github repository.
|
40
|
+
|
41
|
+
$ git clone https://github.com/rhc/nexpose-security-console.git
|
42
|
+
|
43
|
+
- Access the source code folder directory.
|
44
|
+
|
45
|
+
$ cd nexpose-security-console
|
46
|
+
|
47
|
+
- Install the dependencies
|
48
|
+
|
49
|
+
$ bin/setup
|
50
|
+
|
51
|
+
- Install the gem in your local machine
|
52
|
+
|
53
|
+
$ bundle exec rake install
|
54
|
+
|
55
|
+
- Run the test suite
|
56
|
+
|
57
|
+
$ rake test
|
58
|
+
|
59
|
+
== Usage
|
60
|
+
|
61
|
+
You can get help on available commands.
|
62
|
+
|
63
|
+
$ nsc help
|
64
|
+
|
65
|
+
Commands:
|
66
|
+
nsc --version, -v # Print the version
|
67
|
+
nsc help [COMMAND] # Describe available commands or one specific command
|
68
|
+
|
69
|
+
|
70
|
+
List all active scans
|
71
|
+
|
72
|
+
nsc scan list
|
73
|
+
|
74
|
+
Run an adhoc sql query and export via csv
|
75
|
+
|
76
|
+
nsc reports --config ./lab.yaml --sql "select * from dim_asset"
|
77
|
+
|
78
|
+
or for more complex sql queries, put the sql into a file and run
|
79
|
+
|
80
|
+
nsc reports --config ./lab.yaml --sqlfile ./new_assets.sql
|
81
|
+
|
82
|
+
|
83
|
+
List all reports defined
|
84
|
+
|
85
|
+
nsc reports
|
86
|
+
|
87
|
+
Request the console's version details
|
88
|
+
|
89
|
+
nsc console --COMMAND "ver"
|
90
|
+
|
91
|
+
Run an adhoc scan for a single ip or network cidr-noted range ( --id )
|
92
|
+
|
93
|
+
nsc scans create --range 192.168.42.103/32
|
94
|
+
|
95
|
+
how to add a new custom role for configuration within the console ui, based on a copy of existinsc role
|
96
|
+
|
97
|
+
nsc roles -n security-manager --description "New Role Name" --newname new-short-name
|
98
|
+
|
99
|
+
how to add a new user, with default password of "nxpassword" until moved to yaml config is supported
|
100
|
+
|
101
|
+
nsc users create --name <username> --fullname "Full Name"
|
102
|
+
|
103
|
+
how to export packaged scan data in a single zip file
|
104
|
+
|
105
|
+
nsc scan --update --scanpath ./ --action export --id <scan id>
|
106
|
+
|
107
|
+
|
108
|
+
== Configuration
|
109
|
+
|
110
|
+
----
|
111
|
+
# ~/lab.yaml consists of the following:
|
112
|
+
|
113
|
+
config:
|
114
|
+
server: 10.10.10.10
|
115
|
+
port: 3780
|
116
|
+
user: nxuser
|
117
|
+
password: password
|
118
|
+
----
|
119
|
+
|
120
|
+
== License
|
121
|
+
|
122
|
+
The gem is available as open source under the terms of the
|
123
|
+
http://opensource.org/licenses/MIT[MIT License].
|
124
|
+
|
125
|
+
|
126
|
+
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rubygems/package_task'
|
6
|
+
require 'rdoc/task'
|
7
|
+
require 'cucumber'
|
8
|
+
require 'cucumber/rake/task'
|
9
|
+
|
10
|
+
|
11
|
+
Rake::RDocTask.new do |rd|
|
12
|
+
rd.main = "README.rdoc"
|
13
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
14
|
+
rd.title = 'Nexpose Security Console'
|
15
|
+
end
|
16
|
+
|
17
|
+
spec = eval(File.read('nexpose-security-console.gemspec'))
|
18
|
+
|
19
|
+
Gem::PackageTask.new(spec) do |pkg|
|
20
|
+
end
|
21
|
+
|
22
|
+
CUKE_RESULTS = 'results.html'
|
23
|
+
CLEAN << CUKE_RESULTS
|
24
|
+
|
25
|
+
desc 'Run features'
|
26
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
27
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
28
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
29
|
+
t.cucumber_opts = opts
|
30
|
+
t.fork = false
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
34
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
35
|
+
tag_opts = ' --tags ~@pending'
|
36
|
+
tag_opts = ' --tags @wip'
|
37
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
38
|
+
t.fork = false
|
39
|
+
end
|
40
|
+
|
41
|
+
task :cucumber => :features
|
42
|
+
task 'cucumber:wip' => 'features:wip'
|
43
|
+
task :wip => 'features:wip'
|
44
|
+
require 'rake/testtask'
|
45
|
+
Rake::TestTask.new do |t|
|
46
|
+
t.libs << "test"
|
47
|
+
t.test_files = FileList['test/*_test.rb']
|
48
|
+
t.warning = false
|
49
|
+
end
|
50
|
+
|
51
|
+
task :default => [:test,:features]
|
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nexpose-security-console"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
require "pry"
|
10
|
+
Pry.start
|
11
|
+
|
data/bin/setup
ADDED
data/exe/nsc
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
|
4
|
+
include GLI::App
|
5
|
+
|
6
|
+
program_desc 'CLI to interface with Nexpose Security Console'
|
7
|
+
version NexposeSecurityConsole::VERSION
|
8
|
+
|
9
|
+
subcommand_option_handling :normal
|
10
|
+
arguments :strict
|
11
|
+
|
12
|
+
desc 'Describe some switch here'
|
13
|
+
switch [:s,:switch]
|
14
|
+
|
15
|
+
desc 'Describe some flag here'
|
16
|
+
default_value 'the default'
|
17
|
+
arg_name 'The name of the argument'
|
18
|
+
flag [:f,:flagname]
|
19
|
+
|
20
|
+
desc 'Manage sites'
|
21
|
+
arg_name 'Describe arguments to sites here'
|
22
|
+
command :sites do |c|
|
23
|
+
c.desc 'Describe a switch to sites'
|
24
|
+
c.switch :s
|
25
|
+
|
26
|
+
c.desc 'Describe a flag to sites'
|
27
|
+
c.default_value 'default'
|
28
|
+
c.flag :f
|
29
|
+
c.action do |global_options,options,args|
|
30
|
+
|
31
|
+
# Your command logic here
|
32
|
+
# If you have any errors, just raise them
|
33
|
+
# raise "that command made no sense"
|
34
|
+
|
35
|
+
puts "sites command ran"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc 'Manage asset groups'
|
40
|
+
command :groups do |c|
|
41
|
+
c.desc 'List asset groups'
|
42
|
+
c.command :list do |ls|
|
43
|
+
ls.action do |global_options,options,args|
|
44
|
+
puts "list asset groups"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
c.default_command :list
|
48
|
+
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
desc 'Manage assets'
|
53
|
+
arg_name 'Describe arguments to assets here'
|
54
|
+
command :assets do |c|
|
55
|
+
c.action do |global_options,options,args|
|
56
|
+
puts "assets command ran"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Manage reports'
|
61
|
+
arg_name 'Describe arguments to reports here'
|
62
|
+
command :reports do |c|
|
63
|
+
c.action do |global_options,options,args|
|
64
|
+
puts "reports command ran"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
pre do |global,command,options,args|
|
69
|
+
# Pre logic here
|
70
|
+
# Return true to proceed; false to abort and not call the
|
71
|
+
# chosen command
|
72
|
+
# Use skips_pre before a command to skip this block
|
73
|
+
# on that command only
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
post do |global,command,options,args|
|
78
|
+
# Post logic here
|
79
|
+
# Use skips_post before a command to skip this
|
80
|
+
# block on that command only
|
81
|
+
end
|
82
|
+
|
83
|
+
on_error do |exception|
|
84
|
+
# Error logic here
|
85
|
+
# return false to skip default error handling
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
exit run(ARGV)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','nexpose-security-console','version.rb'])
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'nexpose-security-console'
|
5
|
+
spec.version = NexposeSecurityConsole::VERSION
|
6
|
+
spec.authors = ['Christian Kyony']
|
7
|
+
spec.email = ['ckyony@changamuka.com']
|
8
|
+
spec.homepage = 'http://github.com/rhc/nexpose-security-console'
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.license = 'MIT'
|
11
|
+
|
12
|
+
spec.summary = 'Command line utility to interact with the Nexpose Security Console '
|
13
|
+
spec.description = <<-DESC
|
14
|
+
For security engineers
|
15
|
+
Who needs to interact with a Rapid7 Nexpose Security console
|
16
|
+
The nexpose-security-console gem is a Git like command line utility
|
17
|
+
That provides the ability to:
|
18
|
+
|
19
|
+
- create a new site,
|
20
|
+
- add an IP to the site,
|
21
|
+
- perform a scan against the site using a defined/passed scan template,
|
22
|
+
- produce a reports for vulnerabilitie0s, installed software, and policy compliance.
|
23
|
+
- to delete in bulk more than 1000 assets in a given site
|
24
|
+
- etc
|
25
|
+
|
26
|
+
Unlike the Nexposecli gem and other alternatives,
|
27
|
+
nexpose-security-console is designed as command suite a la GIT
|
28
|
+
DESC
|
29
|
+
|
30
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
31
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
32
|
+
if spec.respond_to?(:metadata)
|
33
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
34
|
+
else
|
35
|
+
raise 'RubyGems 2.0+ is required to protect against public gem pushes.'
|
36
|
+
end
|
37
|
+
|
38
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
39
|
+
f.match(%r{^(test|spec|features)/})
|
40
|
+
end
|
41
|
+
spec.bindir = 'exe'
|
42
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
43
|
+
spec.require_paths << 'lib'
|
44
|
+
|
45
|
+
spec.has_rdoc = true
|
46
|
+
spec.extra_rdoc_files = ['README.rdoc','nexpose-security-console.rdoc']
|
47
|
+
spec.rdoc_options << '--title' << 'nexpose-security-console' << '--main' << 'README.rdoc' << '-ri'
|
48
|
+
|
49
|
+
spec.add_development_dependency 'bundler'
|
50
|
+
spec.add_development_dependency 'rake'
|
51
|
+
spec.add_development_dependency 'rdoc'
|
52
|
+
spec.add_development_dependency 'aruba'
|
53
|
+
|
54
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
55
|
+
spec.add_development_dependency 'minitest-reporters'
|
56
|
+
spec.add_development_dependency 'guard'
|
57
|
+
spec.add_development_dependency 'guard-minitest'
|
58
|
+
spec.add_development_dependency 'guard-bundler'
|
59
|
+
spec.add_development_dependency 'byebug', '~> 9.0'
|
60
|
+
spec.add_development_dependency 'simplecov', '~> 0.12'
|
61
|
+
spec.add_development_dependency 'rubocop', '~> 0'
|
62
|
+
spec.add_development_dependency 'gem-release', '~> 0'
|
63
|
+
|
64
|
+
spec.add_dependency 'gli','~> 2.15.0'
|
65
|
+
spec.add_dependency 'nexpose'
|
66
|
+
spec.add_dependency 'dotenv'
|
67
|
+
spec.add_dependency 'progress_bar'
|
68
|
+
|
69
|
+
end
|