nexpose-security-console 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de3dece4aaf7539ef6e8d5893ecfd76964c8d42d
4
- data.tar.gz: 6dd239456f28c663e15a71dff87f4f6d926acfea
3
+ metadata.gz: 30e3ae63139fa29d3781c0db24f4e314ec2b8a0c
4
+ data.tar.gz: d4198d10804c9727956551f93f7f2db3cde16f94
5
5
  SHA512:
6
- metadata.gz: 1a201a462e102f62da9ab57b197a54f2df7b7e16e2e46ef1ecbef4ccc563ee767e8db65f2d1d7fda5e2c9480732853f9396b00b6153535b4ff83018ded86004e
7
- data.tar.gz: 20e49ac6019a219f4e13c5d0c0e9922809660b1b2fec1d2dc0583e2bde3141b73f079cdf5f8bceed2873f0588c300530d6a92d0361f1aa8ea45a06f3a51745eb
6
+ metadata.gz: 5cd9f16707c5c7796c75c7a219b9e6819568a34b0c546ec28ec4472cb48aa7132acc725b2834f962b57e63d8895074e92ece846de4ce31dc3d6f2516275380a9
7
+ data.tar.gz: 4bcd4b8137dac18b2b5ca9575bef734c971f7f366d7d201398b0d40fd713bf486befbbe163435a397404b0a17e31b69c3741687eb0ed191a30dc7135fbd4b968
data/exe/nsc CHANGED
@@ -4,10 +4,6 @@ require "nexpose-security-console"
4
4
  require 'progress_bar'
5
5
  require 'csv'
6
6
 
7
- require 'capybara/poltergeist'
8
- require 'capybara/dsl'
9
- include Capybara::DSL
10
- Capybara.default_driver = :poltergeist
11
7
 
12
8
  include GLI::App
13
9
  include NexposeSecurityConsole
@@ -18,76 +14,16 @@ version NexposeSecurityConsole::VERSION
18
14
  subcommand_option_handling :normal
19
15
  arguments :strict
20
16
 
21
- # desc 'Manage sites'
22
- # arg_name 'Describe arguments to sites here'
23
- # command :sites do |c|
24
- # c.action do |global_options,options,args|
25
- #
26
- # # Your command logic here
27
- # # If you have any errors, just raise them
28
- # # raise "that command made no sense"
29
- #
30
- # puts "sites command ran"
31
- # end
32
- # end
33
- #
34
-
35
- desc 'Verify connection to the server'
36
- command [:connect, :login] do |c|
37
- c.flag [:u, :username], arg_name: 'USERNAME', default_value: ENV['NEXPOSE_USER']
38
- c.flag [:p, :password], arg_name: 'PASSWORD', default_value: ENV['NEXPOSE_PASSWORD']
39
- c.flag [:s, :server], arg_name: 'SERVER', default_value: ENV['NEXPOSE_HOST']
40
- c.flag [:port], arg_name: 'PORT', default_value: 3780, type: Integer
41
-
42
- c.action do |global_options,options,args|
43
- username = options[:username]
44
- password = options[:password]
45
- server = options[:server]
46
- port = options[:port]
47
-
48
- nsc = NexposeSecurityConsole.connection()
49
- puts "Success" if nsc.login
50
- nsc.logout
51
- end
52
- end
53
-
54
- # desc 'Manage asset groups'
55
- # command :groups do |c|
56
- # c.desc 'List asset groups'
57
- # c.command :list do |list|
58
- # list.action do |global_options,options,args|
59
- # puts "list asset groups"
60
- # end
61
- # end
62
- # c.default_command :list
63
- # end
64
- #
65
- #
66
-
67
-
68
- # TODO
69
- # IDEA
70
- # It will be nice
71
- # Nexpose can lazy load the filtered assets
72
-
73
17
  desc 'Bulk delete assets with unknown OS'
74
18
  command :bulk_delete do |c|
75
19
  c.action do |global_options, options, args|
76
20
  puts 'Logging in ...'
77
21
  nsc = NexposeSecurityConsole.login
78
22
  nsc.login
79
- puts 'I am in'
23
+ puts 'I am in.'
80
24
  puts 'Retrieving all assets with unknown OS'
81
25
  puts 'This may take a while. Get some coffee. Be patient ...'
82
26
 
83
- # dag = nsc.asset_groups.find {|group| group.name == 'Unknown OS' }
84
- # group = Nexpose::AssetGroup.load(nsc, dag.id)
85
- # total = group.assets.count
86
- # bar = ProgressBar.new(total, :counter, :percentage, :eta)
87
- # group.assets.each_with_index do |a,i|
88
- # nsc.delete_asset(a.id)
89
- # bar.increment!
90
- # end
91
27
  assets = nsc.filter( Nexpose::Search::Field::OS, Nexpose::Search::Operator::IS_EMPTY )
92
28
  total = assets.count
93
29
  bar = ProgressBar.new(total, :counter, :percentage, :eta)
@@ -100,107 +36,6 @@ command :bulk_delete do |c|
100
36
  end
101
37
  end
102
38
 
103
- desc 'Delete assets via web'
104
- long_desc <<-DESC
105
- Use this command when you have more than 10_000 assets to be deleted.
106
- I used it to delete 100_000 assets in less than 30 minutes
107
- compared to the days required when using the normal Nexpose API.
108
-
109
- NOTE: This command is very dependent on the web interface .
110
- It may break after Nexpose GUI changes.
111
-
112
- DESC
113
- arg_name 'ASSET_GROUP_NAME', default_value: 'Unknown OS'
114
- command :web_delete do |c|
115
- c.flag [:d, :delay], arg_name: 'SECONDS', default_value: 25, type: :integer
116
- c.action do |global_options, options, args|
117
- host = ENV['NEXPOSE_HOST']
118
- port = ENV['NEXPOSE_PORT']
119
- username = ENV['NEXPOSE_USER']
120
- password = ENV['NEXPOSE_PASSWORD']
121
- delay = options['delay']
122
- uri = "https://#{host}:#{port}/login.jsp"
123
- asset_group_name = args.first
124
-
125
- Capybara.default_max_wait_time = delay
126
- loop do
127
- begin
128
- visit uri
129
- rescue
130
- next
131
- end
132
- puts page.title
133
- if page.has_title?( "Log on to Nexpose" )
134
- fill_in 'Username', with: username
135
- fill_in 'Password', with: password
136
- click_button 'Log on'
137
- if page.has_title?('Dashboard')
138
- puts 'Success!'
139
- else
140
- puts 'Invalid Login!'
141
- exit(-1)
142
- end
143
- end
144
- puts page.title
145
- within "#groupSynopsisTable" do
146
- click_link( asset_group_name)
147
- puts page.title
148
- end
149
-
150
- # raise "Sorry, I cannot found an asset group named '#{asset_group_name}'"
151
- txt = find(".showingPage > .yui-pg-current").text
152
- if txt =~ /\d+ to \d+ of (\d+)/
153
- total ||= $1
154
- end
155
-
156
- previous = total.to_i
157
- bar ||= ProgressBar.new(total.to_i, :counter, :percentage, :eta)
158
-
159
- loop do
160
- puts 'step 1: Check the group asset '
161
- find("#selectImage-group-assets").trigger(:click)
162
- puts 'step 2: Select all visible assets'
163
- find("#selectVisible-group-assets").trigger(:click)
164
- puts 'step 3: click the DELETE ASSETS button '
165
- find("#tableButtons-group-assets > #deleteAssetsBtn-group-assets").trigger(:click)
166
- puts 'step 4: Click the YES button'
167
- click_button 'Yes'
168
- sleep 10
169
-
170
- txt = find(".showingPage > .yui-pg-current").text
171
- if txt =~ /\d+ to \d+ of (\d+)/
172
- records = $1.to_i
173
- end
174
- current = records
175
- exit if current == 0
176
- bar.increment!(previous - current)
177
- puts "Number of Assets: #{records}"
178
- if current == previous
179
- sleep 25
180
- break
181
- end
182
- previous = current
183
- end
184
-
185
- end
186
- end
187
- end
188
-
189
- desc 'Manage assets'
190
- arg_name 'Describe arguments to assets here'
191
- command :assets do |c|
192
- c.action do |global_options,options,args|
193
- puts "assets command ran"
194
- end
195
- end
196
-
197
- desc 'Manage reports'
198
- arg_name 'Describe arguments to reports here'
199
- command :reports do |c|
200
- c.action do |global_options,options,args|
201
- puts "reports command ran"
202
- end
203
- end
204
39
 
205
40
  pre do |global,command,options,args|
206
41
  # Pre logic here
@@ -1,7 +1,6 @@
1
1
  require 'nexpose-security-console/version.rb'
2
2
  require 'nexpose'
3
3
  require 'dotenv'
4
- require 'byebug'
5
4
 
6
5
  # Add requires for other files you add to your project here, so
7
6
  # you just need to require this one file in your bin file
@@ -1,3 +1,3 @@
1
1
  module NexposeSecurityConsole
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -54,7 +54,6 @@ Gem::Specification.new do |spec|
54
54
  spec.add_development_dependency 'guard'
55
55
  spec.add_development_dependency 'guard-minitest'
56
56
  spec.add_development_dependency 'guard-bundler'
57
- spec.add_development_dependency 'guard-cucumber'
58
57
  spec.add_development_dependency 'byebug', '~> 9.0'
59
58
  spec.add_development_dependency 'simplecov', '~> 0.12'
60
59
  spec.add_development_dependency 'rubocop', '~> 0'
@@ -64,7 +63,5 @@ Gem::Specification.new do |spec|
64
63
  spec.add_dependency 'nexpose'
65
64
  spec.add_dependency 'dotenv'
66
65
  spec.add_dependency 'progress_bar'
67
- spec.add_dependency 'capybara'
68
- spec.add_dependency 'poltergeist'
69
66
 
70
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexpose-security-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kyony
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-24 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: guard-cucumber
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: byebug
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -262,34 +248,6 @@ dependencies:
262
248
  - - ">="
263
249
  - !ruby/object:Gem::Version
264
250
  version: '0'
265
- - !ruby/object:Gem::Dependency
266
- name: capybara
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - ">="
270
- - !ruby/object:Gem::Version
271
- version: '0'
272
- type: :runtime
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - ">="
277
- - !ruby/object:Gem::Version
278
- version: '0'
279
- - !ruby/object:Gem::Dependency
280
- name: poltergeist
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - ">="
284
- - !ruby/object:Gem::Version
285
- version: '0'
286
- type: :runtime
287
- prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
289
- requirements:
290
- - - ">="
291
- - !ruby/object:Gem::Version
292
- version: '0'
293
251
  description: |2+
294
252
  For security engineers
295
253
  Who need to interact with a Rapid7 Nexpose Security console