cms_scanner 0.13.7 → 0.13.8

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: 4e844a7c12e7e4767678eee8958f7b6c863789f4478553b9260e86dea258c974
4
- data.tar.gz: e203a131365c6b7637842c6296918135e3dc97bb6bd8a922214c3629779e622e
3
+ metadata.gz: c30dcbc053e4087d1f308d8390d026a028ddb2ca7c8f5f01108e72beed649e76
4
+ data.tar.gz: fdd30f85d4a8847da231678c1a785002421f322d65623a9ad66168a007cba420
5
5
  SHA512:
6
- metadata.gz: 4d1f9c65037c59a457dd2fb4370151b0cdc0639d5dcf01d84cfc2fba1b5956ab4761434ee0b85daff31aacf0fd1db0e61c74c34688678a23d72bee7108636ede
7
- data.tar.gz: bb9e70348937efab985f82b5baca41e74fdbcfa7620b7fff1ef9f935f8562e8b0d3531bf0a0a2d73aaa1393305999d6bf3b8656f570b2c012d286784c44b40a3
6
+ metadata.gz: a63a0447cc9f8dcc69974e6b82e93db96d534006e5a5a35b5de56a2374d8a28750034b3490e6180e8d1706a01132eb90ca49e6dc8060c4c625b704a93a76e862
7
+ data.tar.gz: 9b5e1f8fa8cbee20c75b163814196cc08292fbff28a6feb6d5f52f58cf36ecd9bbbd161b8c38abf3476fb7a87e564fcdb5bbb554c0611d4ba0a146dc083cb3e2
@@ -48,14 +48,28 @@ module CMSScanner
48
48
  raise Error::ProxyAuthRequired
49
49
  end
50
50
 
51
- # Checks for redirects
52
- # An out of scope redirect will raise an Error::HTTPRedirect
53
- effective_url = target.homepage_res.effective_url
51
+ handle_redirection(res)
52
+ end
53
+
54
+ # Checks for redirects, an out of scope redirect will raise an Error::HTTPRedirect
55
+ #
56
+ # @param [ Typhoeus::Response ] res
57
+ def handle_redirection(res)
58
+ effective_url = target.homepage_res.effective_url # Basically get and follow location of target.url
59
+ effective_uri = Addressable::URI.parse(effective_url)
60
+
61
+ # Case of http://a.com => https://a.com (or the opposite)
62
+ if !NS::ParsedCli.ignore_main_redirect && target.uri.domain == effective_uri.domain &&
63
+ target.uri.path == effective_uri.path && target.uri.scheme != effective_uri.scheme
64
+
65
+ target.url = effective_url
66
+ end
54
67
 
55
68
  return if target.in_scope?(effective_url)
56
69
 
57
70
  raise Error::HTTPRedirect, effective_url unless NS::ParsedCli.ignore_main_redirect
58
71
 
72
+ # Sets back homepage_res to unfollowed location in case of ignore_main_redirect used
59
73
  target.homepage_res = res
60
74
  end
61
75
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version
4
4
  module CMSScanner
5
- VERSION = '0.13.7'
5
+ VERSION = '0.13.8'
6
6
  end
@@ -115,7 +115,7 @@ module CMSScanner
115
115
 
116
116
  # @return [ Hash ] The Typhoeus params to use to perform head requests
117
117
  def head_or_get_params
118
- @head_or_get_params ||= if NS::Browser.head(homepage_url).code == 405
118
+ @head_or_get_params ||= if [0, 405, 501].include?(NS::Browser.head(homepage_url).code)
119
119
  { method: :get, maxfilesize: 1 }
120
120
  else
121
121
  { method: :head }
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.13.7
4
+ version: 0.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ethon
@@ -236,14 +236,14 @@ dependencies:
236
236
  requirements:
237
237
  - - "~>"
238
238
  - !ruby/object:Gem::Version
239
- version: 1.25.0
239
+ version: 1.26.0
240
240
  type: :development
241
241
  prerelease: false
242
242
  version_requirements: !ruby/object:Gem::Requirement
243
243
  requirements:
244
244
  - - "~>"
245
245
  - !ruby/object:Gem::Version
246
- version: 1.25.0
246
+ version: 1.26.0
247
247
  - !ruby/object:Gem::Dependency
248
248
  name: rubocop-performance
249
249
  requirement: !ruby/object:Gem::Requirement