cms_scanner 0.0.41.2 → 0.0.41.3

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
  SHA256:
3
- metadata.gz: dbc8a5e5ea4c59952b7b9e9b0c989275b1694f2c97f109a12e66c35c45d5918b
4
- data.tar.gz: 289ca0de5f2c507cb21d0e9b80ed5bc06309937271945eeda2a6a5448d8350c5
3
+ metadata.gz: 110b5b109b6dd1c9d09549e7deb8fb7508c9bfb0468b24dd6b6d2c2a4c83301d
4
+ data.tar.gz: 0c09f110f1c432518d16a21f87cd3787b29322bcb109a5180e5aec3f5facd637
5
5
  SHA512:
6
- metadata.gz: 96e2d75cd756402a389cffb1ecfb31aa0e11efcc96634aae67bb35782edfc6b0bf612c6f82eb04cee93f9e4ebaf9c7abf8cc04969a215abdb4f84cba1dda0bb2
7
- data.tar.gz: c521e2d89534f3d2027a00420e2a7662b958e8bcc880e560c07c0e5336c615ce0b859a7b38112287bb1387daf9ed077ce40d6c802a0a9b7f6e6c267ca4b1692f
6
+ metadata.gz: c070cc68a72da9669cefc5792e0d9a8f61ded544cddb4cdc78db2a4dbe9d5f6890e40004761b2f04646b7d685b86c2cd56624d0568b84f0f17fc51c0298b9edb
7
+ data.tar.gz: 9fd44567c3802590a41c8db6fec6c6ed0bfbdff3a91afb70c1832752d119fb61591bf5e24d8c4bad80fe53ef7f486212050b452c93101ef814efafb3f94be2ba
@@ -31,7 +31,10 @@ module CMSScanner
31
31
  OptBoolean.new(['--ignore-main-redirect', 'Ignore the main redirect (if any) and scan the target url'],
32
32
  advanced: true),
33
33
  OptBoolean.new(['-v', '--verbose', 'Verbose mode']),
34
- OptBoolean.new(['--[no-]banner', 'Whether or not to display the banner'], default: true)
34
+ OptBoolean.new(['--[no-]banner', 'Whether or not to display the banner'], default: true),
35
+ OptPositiveInteger.new(['--max-scan-duration SECONDS',
36
+ 'Abort the scan if it exceeds the time provided in seconds'],
37
+ advanced: true)
35
38
  ]
36
39
  end
37
40
 
@@ -13,6 +13,7 @@ require 'erb'
13
13
  require 'uri'
14
14
  require 'fileutils'
15
15
  require 'pathname'
16
+ require 'timeout'
16
17
  require 'xmlrpc/client'
17
18
  # Monkey Patches
18
19
  require 'cms_scanner/typhoeus/response' # Adds a Response#html using Nokogiri to parse the body
@@ -24,6 +25,7 @@ require 'cms_scanner/progressbar_null_output'
24
25
  require 'cms_scanner/helper'
25
26
  require 'cms_scanner/exit_code'
26
27
  require 'cms_scanner/errors/http'
28
+ require 'cms_scanner/errors/scan'
27
29
  require 'cms_scanner/cache/typhoeus'
28
30
  require 'cms_scanner/target'
29
31
  require 'cms_scanner/browser'
@@ -185,7 +187,7 @@ module CMSScanner
185
187
 
186
188
  return NS::ExitCode::INTERRUPTED if run_error.is_a?(Interrupt)
187
189
 
188
- return NS::ExitCode::ERROR if run_error.is_a?(NS::Error)
190
+ return NS::ExitCode::ERROR if run_error.is_a?(NS::Error) || run_error.is_a?(CMSScanner::Error)
189
191
 
190
192
  NS::ExitCode::EXCEPTION
191
193
  end
@@ -39,11 +39,13 @@ module CMSScanner
39
39
 
40
40
  redirect_output_to_file(parsed_options[:output]) if parsed_options[:output]
41
41
 
42
- each(&:before_scan)
43
- each(&:run)
44
- # Reverse is used here as the app/controllers/core#after_scan finishes the output
45
- # and must be the last one to be executed
46
- reverse_each(&:after_scan)
42
+ Timeout.timeout(parsed_options[:max_scan_duration], NS::MaxScanDurationReachedError) do
43
+ each(&:before_scan)
44
+ each(&:run)
45
+ # Reverse is used here as the app/controllers/core#after_scan finishes the output
46
+ # and must be the last one to be executed
47
+ reverse_each(&:after_scan)
48
+ end
47
49
  end
48
50
  end
49
51
  end
@@ -0,0 +1,10 @@
1
+ module CMSScanner
2
+ # Used instead of the Timeout::Error
3
+ class MaxScanDurationReachedError < Error
4
+ # :nocov:
5
+ def to_s
6
+ 'Max Scan Duration Reached'
7
+ end
8
+ # :nocov:
9
+ end
10
+ end
@@ -1,4 +1,4 @@
1
1
  # Version
2
2
  module CMSScanner
3
- VERSION = '0.0.41.2'.freeze
3
+ VERSION = '0.0.41.3'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cms_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41.2
4
+ version: 0.0.41.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam
@@ -280,6 +280,7 @@ files:
280
280
  - lib/cms_scanner/controller.rb
281
281
  - lib/cms_scanner/controllers.rb
282
282
  - lib/cms_scanner/errors/http.rb
283
+ - lib/cms_scanner/errors/scan.rb
283
284
  - lib/cms_scanner/exit_code.rb
284
285
  - lib/cms_scanner/finders.rb
285
286
  - lib/cms_scanner/finders/base_finders.rb