cms_scanner 0.0.15 → 0.0.16

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: e4c298cb52add0fd3b06836ec3d5f5acc7fcc06c
4
- data.tar.gz: 32c3dec825b5d3641b86938ea2641bafb34cc0bd
3
+ metadata.gz: 3954c9c3eb90a7f8acded64914b7b0af297ffffa
4
+ data.tar.gz: 4379facdd8238326dc6f770bd095db747986db95
5
5
  SHA512:
6
- metadata.gz: 4444cb50bf62d3b2715bd49054a539ae058aa234b4f27d013b6dda5fa5bfcc4664fd270e85a00f82d3de99add49729223f4f5333146262f92ad67360ea4d6665
7
- data.tar.gz: dbd2746ebc6b5912d4bf3c828dbc413499d0b1e306dc2826dc8572017a5025adfa9a1b0c4528a49bd44ae5a704a3cee0c04e719376907679e97926913d88166d
6
+ metadata.gz: 8fdefebdce42065da6bdcb82b941facbdae7f2ac2d0fec363c6ff6e1043257546fe257c100509b1e7d7869ce56ce04b3e9ddb19d1b173e1ff58ccd15a8715f99
7
+ data.tar.gz: a8056624c77515e42d8bcc30b022e5ae435c2bb149da9596ba2cb30a7d5171576c5b7f35e582392e8d147c180297f49dc17a6857243ffe1af444f06cb2311a3e
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
 
32
32
  s.add_development_dependency 'rake', '~> 10.4'
33
33
  s.add_development_dependency 'rspec', '~> 3.2'
34
- s.add_development_dependency 'rspec-its', '~> 1.1'
34
+ s.add_development_dependency 'rspec-its', '~> 1.2'
35
35
  s.add_development_dependency 'bundler', '~> 1.6'
36
36
  s.add_development_dependency 'rubocop', '~> 0.29'
37
37
  s.add_development_dependency 'webmock', '~> 1.20'
@@ -44,12 +44,20 @@ module CMSScanner
44
44
  def progress_bar(total)
45
45
  ProgressBar.create(
46
46
  format: '%t %a <%B> (%c / %C) %P%% %e',
47
- title: ' ', # Used to craete a left margin
47
+ title: progress_bar_title,
48
48
  total: total
49
49
  )
50
50
  end
51
51
  # :nocov:
52
52
 
53
+ # Progress Bar title to use, allow instance using this module
54
+ # to display a custom title if needed
55
+ #
56
+ # @return [ String ]
57
+ def progress_bar_title
58
+ ' ' # Used to create a left margin
59
+ end
60
+
53
61
  # @return [ CMSScanner::Browser ]
54
62
  def browser
55
63
  @browser ||= NS::Browser.instance
@@ -17,7 +17,7 @@ module CMSScanner
17
17
  def run(opts = {})
18
18
  each do |finder|
19
19
  symbols_from_mode(opts[:mode]).each do |symbol|
20
- [*finder.send(symbol, opts)].compact.each do |found|
20
+ [*finder.send(symbol, opts.merge(found: findings))].compact.each do |found|
21
21
  findings << found
22
22
  end
23
23
  end
@@ -12,7 +12,7 @@ module CMSScanner
12
12
  def run(opts = {})
13
13
  symbols_from_mode(opts[:mode]).each do |symbol|
14
14
  each do |finder|
15
- [*finder.send(symbol, opts)].compact.each do |found|
15
+ [*finder.send(symbol, opts.merge(found: findings))].compact.each do |found|
16
16
  findings << found
17
17
  end
18
18
  end
@@ -19,7 +19,9 @@ module CMSScanner
19
19
 
20
20
  symbols_from_mode(opts[:mode]).each do |symbol|
21
21
  each do |finder|
22
- [*finder.send(symbol, opts)].compact.each { |found| findings << found }
22
+ [*finder.send(symbol, opts.merge(found: findings))].compact.each do |found|
23
+ findings << found
24
+ end
23
25
 
24
26
  next if opts[:confidence_threshold] <= 0
25
27
 
@@ -1,4 +1,4 @@
1
1
  # Version
2
2
  module CMSScanner
3
- VERSION = '0.0.15'
3
+ VERSION = '0.0.16'
4
4
  end
@@ -29,7 +29,9 @@ describe CMSScanner::Finders::IndependentFinders do
29
29
  let(:mode) { current_mode }
30
30
 
31
31
  it "calls the #{current_mode} method on each finder" do
32
- finders.each { |f| expect(f).to receive(current_mode).ordered }
32
+ finders.each do |f|
33
+ expect(f).to receive(current_mode).with(hash_including(found: [])).ordered
34
+ end
33
35
  end
34
36
  end
35
37
  end
@@ -40,7 +42,7 @@ describe CMSScanner::Finders::IndependentFinders do
40
42
  it 'calls :passive then :aggressive on each finder' do
41
43
  finders.each do |finder|
42
44
  [:passive, :aggressive].each do |method|
43
- expect(finder).to receive(method).ordered
45
+ expect(finder).to receive(method).with(hash_including(found: [])).ordered
44
46
  end
45
47
  end
46
48
  end
@@ -32,10 +32,21 @@ describe CMSScanner::Finders::SameTypeFinders do
32
32
  let(:opts) { super().merge(mode: :mixed) }
33
33
 
34
34
  it 'calls all #passive then #aggressive on finders and returns the best result' do
35
- expect(finders[0]).to receive(:passive).ordered.and_return(dummy_passive)
36
- expect(finders[1]).to receive(:passive).ordered.and_return(noaggressive)
37
- expect(finders[0]).to receive(:aggressive).ordered.and_return(dummy_aggresssive)
38
- expect(finders[1]).to receive(:aggressive).ordered
35
+ expect(finders[0]).to receive(:passive)
36
+ .with(hash_including(found: [])).ordered
37
+ .and_return(dummy_passive)
38
+
39
+ expect(finders[1]).to receive(:passive)
40
+ .with(hash_including(found: [dummy_passive.first])).ordered
41
+ .and_return(noaggressive)
42
+
43
+ expect(finders[0]).to receive(:aggressive)
44
+ .with(hash_including(found: [dummy_passive.first, noaggressive])).ordered
45
+ .and_return(dummy_aggresssive)
46
+
47
+ expect(finders[1]).to receive(:aggressive)
48
+ .with(hash_including(:found))
49
+ .ordered
39
50
 
40
51
  @expected = []
41
52
 
@@ -53,8 +64,13 @@ describe CMSScanner::Finders::SameTypeFinders do
53
64
  let(:opts) { super().merge(mode: :passive) }
54
65
 
55
66
  it 'calls #passive on all finders and returns the best result' do
56
- expect(finders[0]).to receive(:passive).ordered.and_return(dummy_passive)
57
- expect(finders[1]).to receive(:passive).ordered.and_return(noaggressive)
67
+ expect(finders[0]).to receive(:passive)
68
+ .with(hash_including(found: [])).ordered
69
+ .and_return(dummy_passive)
70
+
71
+ expect(finders[1]).to receive(:passive)
72
+ .with(hash_including(found: [dummy_passive.first])).ordered
73
+ .and_return(noaggressive)
58
74
 
59
75
  finders.each { |f| expect(f).to_not receive(:aggressive) }
60
76
 
@@ -71,8 +87,12 @@ describe CMSScanner::Finders::SameTypeFinders do
71
87
  it 'calls #aggressive on all finders and returns the best result' do
72
88
  finders.each { |f| expect(f).to_not receive(:passive) }
73
89
 
74
- expect(finders[0]).to receive(:aggressive).ordered.and_return(dummy_aggresssive)
75
- expect(finders[1]).to receive(:aggressive).ordered
90
+ expect(finders[0]).to receive(:aggressive)
91
+ .with(hash_including(found: [])).ordered
92
+ .and_return(dummy_aggresssive)
93
+
94
+ expect(finders[1]).to receive(:aggressive)
95
+ .with(hash_including(found: [dummy_aggresssive])).ordered
76
96
 
77
97
  @expected = [finding.new('test', confidence: 100, found_by: 'override')]
78
98
  end
@@ -82,12 +82,23 @@ describe CMSScanner::Finders::UniqueFinders do
82
82
 
83
83
  it 'calls all #passive then #aggressive on finders and returns the best result' do
84
84
  # Maybe there is a way to factorise this
85
- expect(finders[0]).to receive(:passive).ordered.and_return(dummy_passive)
86
- expect(finders[1]).to receive(:passive).ordered.and_return(noaggressive)
87
- expect(finders[2]).to receive(:passive).ordered
88
- expect(finders[0]).to receive(:aggressive).ordered.and_return(dummy_aggresssive)
89
- expect(finders[1]).to receive(:aggressive).ordered
90
- expect(finders[2]).to receive(:aggressive).ordered.and_return(dummy2_aggressive)
85
+ expect(finders[0]).to receive(:passive)
86
+ .with(hash_including(found: [])).ordered
87
+ .and_return(dummy_passive)
88
+
89
+ expect(finders[1]).to receive(:passive)
90
+ .with(hash_including(found: [dummy_passive.first])).ordered
91
+ .and_return(noaggressive)
92
+
93
+ expect(finders[2]).to receive(:passive)
94
+ .with(hash_including(found: [dummy_passive.first, noaggressive])).ordered
95
+
96
+ expect(finders[0]).to receive(:aggressive).with(hash_including(:found)).ordered
97
+ .and_return(dummy_aggresssive)
98
+
99
+ expect(finders[1]).to receive(:aggressive).with(hash_including(:found)).ordered
100
+ expect(finders[2]).to receive(:aggressive).with(hash_including(:found)).ordered
101
+ .and_return(dummy2_aggressive)
91
102
 
92
103
  @expected = finding.new('v1', confidence: 100, found_by: 'Dummy (Passive Detection)')
93
104
  @expected.confirmed_by << finding.new('v1', confidence: 100, found_by: 'override')
@@ -99,9 +110,16 @@ describe CMSScanner::Finders::UniqueFinders do
99
110
  let(:opts) { super().merge(mode: :passive) }
100
111
 
101
112
  it 'calls #passive on all finders and returns the best result' do
102
- expect(finders[0]).to receive(:passive).ordered.and_return(dummy_passive)
103
- expect(finders[1]).to receive(:passive).ordered.and_return(noaggressive)
104
- expect(finders[2]).to receive(:passive).ordered
113
+ expect(finders[0]).to receive(:passive)
114
+ .with(hash_including(found: [])).ordered
115
+ .and_return(dummy_passive)
116
+
117
+ expect(finders[1]).to receive(:passive)
118
+ .with(hash_including(found: [dummy_passive.first])).ordered
119
+ .and_return(noaggressive)
120
+
121
+ expect(finders[2]).to receive(:passive)
122
+ .with(hash_including(found: [dummy_passive.first, noaggressive])).ordered
105
123
 
106
124
  finders.each { |f| expect(f).to_not receive(:aggressive) }
107
125
 
@@ -116,9 +134,16 @@ describe CMSScanner::Finders::UniqueFinders do
116
134
  it 'calls #aggressive on all finders and returns the best result' do
117
135
  finders.each { |f| expect(f).to_not receive(:passive) }
118
136
 
119
- expect(finders[0]).to receive(:aggressive).ordered.and_return(dummy_aggresssive)
120
- expect(finders[1]).to receive(:aggressive).ordered
121
- expect(finders[2]).to receive(:aggressive).ordered.and_return(dummy2_aggressive)
137
+ expect(finders[0]).to receive(:aggressive)
138
+ .with(hash_including(found: [])).ordered
139
+ .and_return(dummy_aggresssive)
140
+
141
+ expect(finders[1]).to receive(:aggressive)
142
+ .with(hash_including(found: [dummy_aggresssive])).ordered
143
+
144
+ expect(finders[2]).to receive(:aggressive)
145
+ .with(hash_including(:found)).ordered
146
+ .and_return(dummy2_aggressive)
122
147
 
123
148
  @expected = finding.new('v1', confidence: 100, found_by: 'override')
124
149
  @expected.confirmed_by << finding.new('v1', confidence: 90)
@@ -132,10 +157,20 @@ describe CMSScanner::Finders::UniqueFinders do
132
157
 
133
158
  it 'calls all #passive then #aggressive methods on finders and returns the '\
134
159
  'result which reaches 100% confidence during the process' do
135
- expect(finders[0]).to receive(:passive).ordered.and_return(dummy_passive)
136
- expect(finders[1]).to receive(:passive).ordered.and_return(noaggressive)
137
- expect(finders[2]).to receive(:passive).ordered
138
- expect(finders[0]).to receive(:aggressive).ordered.and_return(dummy_aggresssive)
160
+ expect(finders[0]).to receive(:passive)
161
+ .with(hash_including(found: [])).ordered
162
+ .and_return(dummy_passive)
163
+
164
+ expect(finders[1]).to receive(:passive)
165
+ .with(hash_including(found: [dummy_passive.first])).ordered
166
+ .and_return(noaggressive)
167
+
168
+ expect(finders[2]).to receive(:passive)
169
+ .with(hash_including(found: [dummy_passive.first, noaggressive])).ordered
170
+
171
+ expect(finders[0]).to receive(:aggressive).with(hash_including(:found)).ordered
172
+ .and_return(dummy_aggresssive)
173
+
139
174
  expect(finders[1]).to_not receive(:aggressive)
140
175
  expect(finders[2]).to_not receive(:aggressive)
141
176
 
@@ -148,9 +183,16 @@ describe CMSScanner::Finders::UniqueFinders do
148
183
  let(:opts) { super().merge(mode: :passive) }
149
184
 
150
185
  it 'calls all #passive and returns the best result' do
151
- expect(finders[0]).to receive(:passive).ordered.and_return(dummy_passive)
152
- expect(finders[1]).to receive(:passive).ordered.and_return(noaggressive)
153
- expect(finders[2]).to receive(:passive).ordered
186
+ expect(finders[0]).to receive(:passive)
187
+ .with(hash_including(found: [])).ordered
188
+ .and_return(dummy_passive)
189
+
190
+ expect(finders[1]).to receive(:passive)
191
+ .with(hash_including(found: [dummy_passive.first])).ordered
192
+ .and_return(noaggressive)
193
+
194
+ expect(finders[2]).to receive(:passive)
195
+ .with(hash_including(found: [dummy_passive.first, noaggressive])).ordered
154
196
 
155
197
  finders.each { |f| expect(f).to_not receive(:aggressive) }
156
198
 
@@ -165,7 +207,10 @@ describe CMSScanner::Finders::UniqueFinders do
165
207
  it 'calls all #aggressive and returns the result which reaches 100% confidence' do
166
208
  finders.each { |f| expect(f).to_not receive(:passive) }
167
209
 
168
- expect(finders[0]).to receive(:aggressive).ordered.and_return(dummy_aggresssive)
210
+ expect(finders[0]).to receive(:aggressive)
211
+ .with(hash_including(found: [])).ordered
212
+ .and_return(dummy_aggresssive)
213
+
169
214
  expect(finders[1]).to_not receive(:aggressive)
170
215
  expect(finders[2]).to_not receive(:aggressive)
171
216
 
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.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam - Erwan Le Rousseau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-21 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opt_parse_validator
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.1'
145
+ version: '1.2'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.1'
152
+ version: '1.2'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: bundler
155
155
  requirement: !ruby/object:Gem::Requirement