cms_scanner 0.0.39.0 → 0.0.39.1

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: 03b9e99b72381c97d4645a032bad36d89d19b942
4
- data.tar.gz: 5115bf315c7d6c85f38cde547f676aeca5d330ce
3
+ metadata.gz: c506e545bbc520583708c6c0f1fb9bbbe123f4ec
4
+ data.tar.gz: 8fcdb2761bdd345469fb69f9c4b6c081e562ecc6
5
5
  SHA512:
6
- metadata.gz: c39ea44958cf6016a8065762e3481d435e1617f891c55f6f457478dae261e920b9dd0926807a8af3365c10388374891323fb243fe226f309627aa0294397c5b7
7
- data.tar.gz: fb8a4133f0b00ac98d7e36908f3a6a6bdf5976328b70df31979b7ef939fcc93689504e051b1579ff83915be2ea0404c61d12ace884f045e5ad80e26e7a35f6e7
6
+ metadata.gz: 69ce15c63489b1c55d98c2f3440c28ac8c699f9c0a666d1749a954b3f3e02faa820c2956f7dfdf648fb9e7b43c38ac39d650ea3cfe62aeb997cf5db1fd5e7cba
7
+ data.tar.gz: 1418729d154f6f7e83998f29660fe88f855840aa4bf79885ebbdd8b62cc99a67166c2518244bd80ce212341b0e30aa8fe6c1f5702296f8f75057ecbe43222436
@@ -14,12 +14,20 @@ module CMSScanner
14
14
  end
15
15
 
16
16
  def before_scan
17
- output('banner') if parsed_options[:banner]
17
+ maybe_output_banner_help_and_version
18
18
 
19
19
  setup_cache
20
20
  check_target_availability
21
21
  end
22
22
 
23
+ def maybe_output_banner_help_and_version
24
+ output('banner') if parsed_options[:banner]
25
+ output('help', help: option_parser.to_s) if parsed_options[:help]
26
+ output('version') if parsed_options[:version]
27
+
28
+ exit(NS::ExitCode::OK) if parsed_options[:help] || parsed_options[:version]
29
+ end
30
+
23
31
  # Checks that the target is accessible, raises related errors otherwise
24
32
  #
25
33
  # @return [ Void ]
@@ -6,10 +6,10 @@ module CMSScanner
6
6
  formats = NS::Formatter.availables
7
7
 
8
8
  [
9
- OptURL.new(['-u', '--url URL', 'The URL to scan'], required: true, default_protocol: 'http'),
10
- OptBoolean.new(['--ignore-main-redirect', 'Ignore the main redirect if any and scan the target url']),
11
- OptBoolean.new(%w[-v --verbose]),
12
- OptBoolean.new(['--[no-]banner', 'Whether or not to display the banner'], default: true),
9
+ OptURL.new(['-u', '--url URL', 'The URL to scan'],
10
+ required_unless: %i[help version],
11
+ default_protocol: 'http')
12
+ ] + mixed_cli_options + [
13
13
  OptFilePath.new(['-o', '--output FILE', 'Output to FILE'], writable: true, exists: false),
14
14
  OptChoice.new(['-f', '--format FORMAT',
15
15
  'Output results in the format supplied'], choices: formats),
@@ -23,6 +23,16 @@ module CMSScanner
23
23
  ] + cli_browser_options
24
24
  end
25
25
 
26
+ def mixed_cli_options
27
+ [
28
+ OptBoolean.new(['-h', '--help', 'Display the help and exit']),
29
+ OptBoolean.new(['--version', 'Display the version and exit']),
30
+ OptBoolean.new(['--ignore-main-redirect', 'Ignore the main redirect (if any) and scan the target url']),
31
+ OptBoolean.new(['-v', '--verbose', 'Verbose mode']),
32
+ OptBoolean.new(['--[no-]banner', 'Whether or not to display the banner'], default: true)
33
+ ]
34
+ end
35
+
26
36
  # @return [ Array<OptParseValidator::OptBase> ]
27
37
  def cli_browser_options
28
38
  cli_browser_headers_options + [
@@ -1,3 +1,4 @@
1
1
  require_relative 'formatters/cli'
2
2
  require_relative 'formatters/cli_no_colour'
3
+ require_relative 'formatters/cli_no_color'
3
4
  require_relative 'formatters/json'
@@ -0,0 +1,7 @@
1
+ module CMSScanner
2
+ module Formatter
3
+ # Because Reason https://github.com/wpscanteam/CMSScanner/issues/56
4
+ class CliNoColor < CliNoColour
5
+ end
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ <%= @help %>
@@ -0,0 +1 @@
1
+ Version: <%= NS::VERSION %>
@@ -0,0 +1 @@
1
+ "help": <%= @help.to_s.to_json %>,
@@ -0,0 +1 @@
1
+ "version": <%= NS::VERSION.to_s.to_json %>,
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.require_path = 'lib'
33
33
 
34
34
  s.add_dependency 'nokogiri', '~> 1.8.0'
35
- s.add_dependency 'opt_parse_validator', '~> 0.0.15.0'
35
+ s.add_dependency 'opt_parse_validator', '~> 0.0.15.2'
36
36
  s.add_dependency 'public_suffix', '~> 3.0.0'
37
37
  s.add_dependency 'ruby-progressbar', '~> 1.9.0'
38
38
  s.add_dependency 'typhoeus', '~> 1.3.0'
@@ -50,5 +50,5 @@ Gem::Specification.new do |s|
50
50
  s.add_development_dependency 'rspec-its', '~> 1.2.0'
51
51
  s.add_development_dependency 'rubocop', '~> 0.52.0'
52
52
  s.add_development_dependency 'simplecov', '~> 0.14.0' # Can't update to 0.15 as it breaks coveralls dep
53
- s.add_development_dependency 'webmock', '~> 3.2.0'
53
+ s.add_development_dependency 'webmock', '~> 3.3.0'
54
54
  end
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
35
35
  s.require_path = 'lib'
36
36
 
37
- s.add_dependency 'cms_scanner', '~> 0.0.38.1'
37
+ s.add_dependency 'cms_scanner', '~> 0.0.39.0'
38
38
 
39
39
  # Already required by CMSScanner, so version restrictions loosen
40
40
  s.add_dependency 'activesupport', '~> 5.1'
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
45
45
  s.add_development_dependency 'rake', '~> 12.0'
46
46
  s.add_development_dependency 'rspec', '~> 3.7.0'
47
47
  s.add_development_dependency 'rspec-its', '~> 1.2.0'
48
- s.add_development_dependency 'rubocop', '~> 0.51.0'
48
+ s.add_development_dependency 'rubocop', '~> 0.52.0'
49
49
  s.add_development_dependency 'simplecov', '~> 0.14.0' # Can't update to 0.15 as it breaks coveralls dep
50
- s.add_development_dependency 'webmock', '~> 3.1.0'
50
+ s.add_development_dependency 'webmock', '~> 3.3.0'
51
51
  end
@@ -31,6 +31,16 @@ module CMSScanner
31
31
  @@target ||= NS::Target.new(parsed_options[:url], parsed_options)
32
32
  end
33
33
 
34
+ # @param [ OptParsevalidator::OptParser ] parser
35
+ def self.option_parser=(parser)
36
+ @@option_parser = parser
37
+ end
38
+
39
+ # @return [ OptParsevalidator::OptParser ]
40
+ def option_parser
41
+ @@option_parser
42
+ end
43
+
34
44
  # Set the parsed options and initialize the browser
35
45
  # with them
36
46
  #
@@ -34,6 +34,7 @@ module CMSScanner
34
34
 
35
35
  def run
36
36
  parsed_options = option_parser.results
37
+ first.class.option_parser = option_parser
37
38
  first.class.parsed_options = parsed_options
38
39
 
39
40
  redirect_output_to_file(parsed_options[:output]) if parsed_options[:output]
@@ -1,4 +1,4 @@
1
1
  # Version
2
2
  module CMSScanner
3
- VERSION = '0.0.39.0'.freeze
3
+ VERSION = '0.0.39.1'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cms_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39.0
4
+ version: 0.0.39.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-15 00:00:00.000000000 Z
11
+ date: 2018-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.15.0
33
+ version: 0.0.15.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.15.0
40
+ version: 0.0.15.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: public_suffix
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +226,14 @@ dependencies:
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: 3.2.0
229
+ version: 3.3.0
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: 3.2.0
236
+ version: 3.3.0
237
237
  description: Framework to provide an easy way to implement CMS Scanners
238
238
  email:
239
239
  - team@wpscan.org
@@ -257,6 +257,7 @@ files:
257
257
  - app/finders/interesting_findings/xml_rpc.rb
258
258
  - app/formatters.rb
259
259
  - app/formatters/cli.rb
260
+ - app/formatters/cli_no_color.rb
260
261
  - app/formatters/cli_no_colour.rb
261
262
  - app/formatters/json.rb
262
263
  - app/models.rb
@@ -269,14 +270,18 @@ files:
269
270
  - app/user_agents.txt
270
271
  - app/views/cli/core/banner.erb
271
272
  - app/views/cli/core/finished.erb
273
+ - app/views/cli/core/help.erb
272
274
  - app/views/cli/core/started.erb
275
+ - app/views/cli/core/version.erb
273
276
  - app/views/cli/interesting_findings/_array.erb
274
277
  - app/views/cli/interesting_findings/findings.erb
275
278
  - app/views/cli/scan_aborted.erb
276
279
  - app/views/cli/usage.erb
277
280
  - app/views/json/core/banner.erb
278
281
  - app/views/json/core/finished.erb
282
+ - app/views/json/core/help.erb
279
283
  - app/views/json/core/started.erb
284
+ - app/views/json/core/version.erb
280
285
  - app/views/json/interesting_findings/findings.erb
281
286
  - app/views/json/scan_aborted.erb
282
287
  - cms_scanner.gemspec