avs 0.0.1 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bb99919abb59c669c0bcdb832755f893aa4c882e1393914b70f14192af603cb
4
- data.tar.gz: 43d608e74bfde138cf7a879e905db2244fdacdba3abf9919822825411efa3bfb
3
+ metadata.gz: 06a221a9832977a50b1b4858fd26e07d16cadc09aaacda98bc2da4707f7c24ed
4
+ data.tar.gz: da896c73f524a8f2125148edcbaea2cd6505a3179c8e0d6951b568536a128f49
5
5
  SHA512:
6
- metadata.gz: 3ffc5c54d18016ee458012ac4e41ecfae27dd0eac9f6961758ab84a37e2365832e5ba7e9760aab661bfa75daaf4101dcdb966d3b12b1aef73f0c84598801f5be
7
- data.tar.gz: 167d7e2663fb659649d986af8d269ea3d7023396e5f2e936c3a8ed68929ad468666bb41dde58cc82c8a3b230598147a6e219664354136c67265de0b7987ee383
6
+ metadata.gz: 132d8f365dbdc3dc17441d14235f2a9e9b98b29518737f9723f5fa567f2728fc4685c451669bc2e0378d54c29d05ae5329c810b465ad9bb2da35773e5980f2a6
7
+ data.tar.gz: f880afb358be424a71b30094e8315537631d99ab78e3fde502e707a76e4da17856d73a15df9eded3603511d391da16f85f3f67b2b52c5946745e9bf1b974174c
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .env
2
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ avs (0.0.8)
5
+ gli (~> 2.21.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ gli (2.21.1)
11
+ minitest (5.22.3)
12
+ psych (5.1.2)
13
+ stringio
14
+ rake (13.1.0)
15
+ rdoc (6.6.2)
16
+ psych (>= 4.0.0)
17
+ stringio (3.1.0)
18
+
19
+ PLATFORMS
20
+ arm64-darwin-21
21
+
22
+ DEPENDENCIES
23
+ avs!
24
+ minitest
25
+ rake
26
+ rdoc
27
+
28
+ BUNDLED WITH
29
+ 2.4.8
data/README.adoc ADDED
@@ -0,0 +1,162 @@
1
+ = avs
2
+ Christian Kyony <ckyony@changamuka.com>
3
+ v0.0.1, 2024-03.14
4
+
5
+ :uri-freesoftware: https://www.gnu.org/philosophy/free-sw.html
6
+
7
+
8
+
9
+
10
+ == For security engineers
11
+ who need to interact with a Rapid7 Nexpose console,
12
+ the *avs* gem is a command line utility
13
+ that manage (e.g. create, list, update, and remove) the following entities:
14
+ - sites,
15
+ - scans,
16
+ - assets,
17
+ - asset groups,
18
+ - reports,
19
+ - vulnerabilities
20
+ - etc...
21
+
22
+
23
+
24
+ == Personal scratch
25
+
26
+ I need to automate the creation of hundreds sites and reports.
27
+
28
+
29
+ == Installation
30
+
31
+ Simply run the command below
32
+
33
+ ----
34
+ $ gem install avs
35
+ ----
36
+
37
+
38
+ == Usage
39
+
40
+ You can get help on available commands.
41
+
42
+ ----
43
+ NAME
44
+ nsc - CLI to interface with Nexpose Security Console
45
+
46
+ SYNOPSIS
47
+ nsc [global options] command [command options] [arguments...]
48
+
49
+ VERSION
50
+ 0.0.2
51
+
52
+ GLOBAL OPTIONS
53
+ --help - Show this message
54
+ --version - Display the program version
55
+
56
+ COMMANDS
57
+ assets - Manage assets
58
+ bulk_delete - Bulk delete assets with unknown OS
59
+ connect, login - Verify connection to the server
60
+ groups - Manage asset groups
61
+ help - Shows a list of commands or help for one command
62
+ reports - Manage reports
63
+ sites - Manage sites
64
+ ----
65
+
66
+ // List all active scans
67
+ //
68
+ // nsc scan list
69
+ //
70
+ // Run an adhoc sql query and export via csv
71
+ //
72
+ // nsc reports --sql "select * from dim_asset"
73
+ //
74
+ // or for more complex sql queries, put the sql into a file and run
75
+ //
76
+ // nsc reports --sqlfile ./new_assets.sql
77
+ //
78
+ //
79
+ // List all reports defined
80
+ //
81
+ // nsc reports
82
+ //
83
+ // Request the console's version details
84
+ //
85
+ // nsc console commands "ver"
86
+ //
87
+ // Run an adhoc scan for a single ip or network cidr-noted range ( --id )
88
+ //
89
+ // nsc scans create --range 192.168.42.103/32
90
+ //
91
+ // how to add a new custom role for configuration within the console ui, based on a copy of existinsc role
92
+ //
93
+ // nsc roles -n security-manager --description "New Role Name" --newname new-short-name
94
+ //
95
+ // how to add a new user, with default password of "nxpassword" until moved to yaml config is supported
96
+ //
97
+ // nsc users create --name <username> --fullname "Full Name"
98
+ //
99
+ // how to export packaged scan data in a single zip file
100
+ //
101
+ // nsc scan --update --scanpath ./ --action export --id <scan id>
102
+ //
103
+
104
+ == Configuration
105
+
106
+ ----
107
+ # ~/lab.yaml consists of the following:
108
+
109
+ config:
110
+ server: 10.10.10.10
111
+ port: 3780
112
+ user: nxuser
113
+ password: password
114
+ ----
115
+
116
+
117
+ == Development
118
+
119
+ Checkout the github repository
120
+
121
+ git clone https://github.com/rhc/avs
122
+
123
+ Access the source code folder directory.
124
+
125
+ $ cd avs
126
+
127
+ Install dependencies
128
+
129
+ bin/setup
130
+
131
+ Run the tests
132
+
133
+ rake test
134
+
135
+ Experiment with the code under development
136
+
137
+ run bin/console
138
+
139
+ Install this gem onto your local machine
140
+
141
+ bundle exec rake install
142
+
143
+ Release a new version
144
+
145
+ gem bump
146
+ gem release
147
+
148
+ == Contributing
149
+
150
+ In the spirit of {uri-freesoftware}[free software],
151
+ everyone is encouraged to help improve this project.
152
+
153
+ If you discover errors or omissions in the source code, documentation, or website content,
154
+ please don’t hesitate to submit an issue or open a pull request with a fix. New contributors are always welcome!
155
+
156
+ == License
157
+
158
+ The gem is available as open source under the terms of the
159
+ http://opensource.org/licenses/MIT[MIT License].
160
+
161
+
162
+
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ Rake::RDocTask.new do |rd|
6
+ rd.main = "README.rdoc"
7
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
8
+ rd.title = 'Your application title'
9
+ end
10
+
11
+ spec = eval(File.read('avs.gemspec'))
12
+
13
+ Gem::PackageTask.new(spec) do |pkg|
14
+ end
15
+ require 'rake/testtask'
16
+ Rake::TestTask.new do |t|
17
+ t.libs << "test"
18
+ t.test_files = FileList['test/*_test.rb']
19
+ end
20
+
21
+ task :default => :test
data/avs.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__), 'lib', 'avs', 'version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'avs'
5
+ s.version = Avs::VERSION
6
+ s.author = 'Christian Kyony'
7
+ s.email = 'ckyony@changamuka.com'
8
+ s.homepage = 'https://github.com/rhc/avs'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'A description of your project'
11
+ s.files = `git ls-files`.split(' ')
12
+ s.require_paths << 'lib'
13
+ s.extra_rdoc_files = ['README.adoc', 'avs.rdoc']
14
+ s.rdoc_options << '--title' << 'avs' << '--main' << 'README.rdoc' << '-ri'
15
+ s.bindir = 'bin'
16
+ s.executables << 'avs'
17
+ s.add_development_dependency('minitest')
18
+ s.add_development_dependency('rake')
19
+ s.add_development_dependency('rdoc')
20
+ s.add_runtime_dependency('gli', '~> 2.21.1')
21
+ end
data/bin/avs CHANGED
@@ -20,18 +20,17 @@ class App
20
20
  arg_name 'The name of the argument'
21
21
  flag [:f,:flagname]
22
22
 
23
-
24
- desc 'Describe vulnerability here'
23
+ desc 'Manage vulnerabilities'
25
24
  arg_name 'Describe arguments to vulnerability here'
26
- command :vulnerability do |c|
25
+ command :vulnerabilities do |c|
27
26
  c.action do |global_options,options,args|
28
27
  puts "vulnerability command ran"
29
28
  end
30
29
  end
31
30
 
32
- desc 'Describe solution here'
31
+ desc 'Manage solutions'
33
32
  arg_name 'Describe arguments to solution here'
34
- command :solution do |c|
33
+ command :solutions do |c|
35
34
  c.action do |global_options,options,args|
36
35
  puts "solution command ran"
37
36
  end
@@ -0,0 +1,24 @@
1
+ require_relative 'model'
2
+ require_relative 'fixture'
3
+
4
+ class App
5
+ extend GLI::App
6
+
7
+ desc 'Manage assets'
8
+ arg_name 'Describe arguments to asset here'
9
+ command :assets do |c|
10
+ c.desc 'Describe a switch to asset'
11
+ c.switch :s
12
+
13
+ c.desc 'Describe a flag to asset'
14
+ c.default_value 'default'
15
+ c.flag :f
16
+ c.action do |_global_options, _options, _args|
17
+ # Your command logic specific to 'asset' here
18
+ assets = fetch_fixtures
19
+ assets.each do |asset|
20
+ puts asset
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,54 @@
1
+ require_relative 'model'
2
+
3
+ def fetch_fixtures
4
+ [
5
+ CmdbAsset.new(
6
+ id: 100,
7
+ country_code: 'cd',
8
+ business_unit: 'bu',
9
+ sub_area: 'sa',
10
+ application: 'ewallet',
11
+ utr: 'UTR01966',
12
+ fqdn: 'fqdn.co.za',
13
+ host_name: 'fqdn',
14
+ ip_address: '172.16.19.66',
15
+ operating_system: 'ubuntu',
16
+ server_environment: 'linux',
17
+ server_category: 'linux',
18
+ host_key: 'xxxx',
19
+ country: 'DRC'
20
+ ),
21
+ CmdbAsset.new(
22
+ id: 200,
23
+ country_code: 'mw',
24
+ business_unit: 'bu',
25
+ sub_area: 'sa',
26
+ application: 'atm',
27
+ utr: 'UTR01966',
28
+ fqdn: 'fqdn.co.za',
29
+ host_name: 'fqdn',
30
+ ip_address: '198.172.19.66',
31
+ operating_system: 'ubuntu',
32
+ server_environment: 'linux',
33
+ server_category: 'linux',
34
+ host_key: 'xxxx',
35
+ country: 'Malawi'
36
+ ),
37
+ CmdbAsset.new(
38
+ id: 300,
39
+ country_code: 'bw',
40
+ business_unit: 'bu',
41
+ sub_area: 'sa',
42
+ application: 'forex',
43
+ utr: 'UTR01986',
44
+ fqdn: 'fqdn.co.za',
45
+ host_name: 'fqdn',
46
+ ip_address: '10.12.19.66',
47
+ operating_system: 'ubuntu',
48
+ server_environment: 'linux',
49
+ server_category: 'linux',
50
+ host_key: 'xxxx',
51
+ country: 'Botswana'
52
+ )
53
+ ]
54
+ end
@@ -0,0 +1,71 @@
1
+ class CmdbAsset
2
+ attr_accessor :id,
3
+ :country_code,
4
+ :business_unit,
5
+ :sub_area,
6
+ :application,
7
+ :utr,
8
+ :fqdn,
9
+ :host_name,
10
+ :ip_address,
11
+ :operating_system,
12
+ :server_environment,
13
+ :server_category,
14
+ :host_key,
15
+ :country
16
+
17
+ def initialize(id:,
18
+ country_code:,
19
+ business_unit:,
20
+ sub_area:,
21
+ application:,
22
+ utr:,
23
+ fqdn:,
24
+ host_name:,
25
+ ip_address:,
26
+ operating_system:,
27
+ server_environment:,
28
+ server_category:,
29
+ host_key:,
30
+ country:)
31
+ @id = id
32
+ @country_code = country_code
33
+ @business_unit = business_unit
34
+ @sub_area = sub_area
35
+ @application = application
36
+ @utr = utr
37
+ @fqdn = fqdn
38
+ @host_name = host_name
39
+ @ip_address = ip_address
40
+ @operating_system = operating_system
41
+ @server_category = server_category
42
+ @server_environment = server_environment
43
+ @host_key = host_key
44
+ @country = country
45
+ end
46
+
47
+ def site_name
48
+ ['', country_code, business_unit, sub_area, application, utr].join(':')
49
+ end
50
+
51
+ def self.from_csv(row)
52
+ CmdbAsset.new(id: row[:id],
53
+ country_code: row[:country_code],
54
+ country: row[:country],
55
+ business_unit: row[:business_unit],
56
+ sub_area: row[:sub_area],
57
+ application: row[:application],
58
+ utr: row[:utr],
59
+ fqdn: row[:fqdn],
60
+ ip_address: row[:ip_address],
61
+ host_name: row[:host_name],
62
+ host_key: row[:host_key],
63
+ operating_system: row[:operating_system],
64
+ server_environment: row[:server_environment],
65
+ server_category: row[:server_category])
66
+ end
67
+
68
+ def to_s
69
+ [id, site_name, fqdn, ip_address].join ','
70
+ end
71
+ end
@@ -0,0 +1,3 @@
1
+ module Avs
2
+ VERSION = '0.0.8'
3
+ end
data/lib/avs.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'avs/version'
2
+
3
+ # Add requires for other files you add to your project here, so
4
+ # you just need to require this one file in your bin file
5
+ require_relative 'asset/command'
@@ -0,0 +1,14 @@
1
+ require_relative "test_helper"
2
+
3
+ class DefaultTest < Minitest::Test
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ require "minitest/autorun"
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+ # Add helper classes or methods here, too
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kyony
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -72,13 +72,25 @@ executables:
72
72
  - avs
73
73
  extensions: []
74
74
  extra_rdoc_files:
75
- - README.rdoc
75
+ - README.adoc
76
76
  - avs.rdoc
77
77
  files:
78
- - README.rdoc
78
+ - ".gitignore"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - README.adoc
82
+ - Rakefile
83
+ - avs.gemspec
79
84
  - avs.rdoc
80
85
  - bin/avs
81
- homepage: http://your.website.com
86
+ - lib/asset/command.rb
87
+ - lib/asset/fixture.rb
88
+ - lib/asset/model.rb
89
+ - lib/avs.rb
90
+ - lib/avs/version.rb
91
+ - test/default_test.rb
92
+ - test/test_helper.rb
93
+ homepage: https://github.com/rhc/avs
82
94
  licenses: []
83
95
  metadata: {}
84
96
  post_install_message:
data/README.rdoc DELETED
@@ -1,6 +0,0 @@
1
- = avs
2
-
3
- Describe your project here
4
-
5
- :include:avs.rdoc
6
-