cms_scanner 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/headers.rb +1 -1
- data/app/views/cli/interesting_files/_array.erb +10 -0
- data/app/views/cli/interesting_files/findings.erb +7 -7
- data/lib/cms_scanner/version.rb +1 -1
- data/spec/app/controllers/core_spec.rb +1 -1
- data/spec/app/models/headers_spec.rb +1 -1
- data/spec/app/views_spec.rb +36 -0
- data/spec/fixtures/interesting_files/headers/interesting.txt +2 -0
- data/spec/lib/controller_spec.rb +2 -1
- data/spec/output/core/finished.cli_no_colour +4 -0
- data/spec/output/core/finished.json +5 -0
- data/spec/output/core/started.cli_no_colour +3 -0
- data/spec/output/core/started.json +5 -0
- data/spec/output/interesting_files/findings.cli_no_colour +25 -0
- data/spec/output/interesting_files/findings.json +3 -0
- data/spec/shared_examples.rb +2 -1
- data/spec/shared_examples/views/core.rb +26 -0
- data/spec/shared_examples/views/interesting_files.rb +25 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4df8e5a102999fc7c177b6b99e3b2c31b6753a4
|
4
|
+
data.tar.gz: 5558b190e7bf8f1b1ea5d13354fdb4ebab2c4b2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e28abacf6e31208804bbdc0e1f61368bcb598d3460f49940476bc8f878b7f9f9d0f2c9e579551ac15abcac69e49cf14e79848e0fe6256aa6c5f6acc91aef11b
|
7
|
+
data.tar.gz: 49c1f25826da617ab18d36241c63cc2b012faef1a9391fa70297ed309c46a4064f5e6deb11bddf91ff7655f885cfa99852f3e88343eaa2872f2bd13275271643
|
data/app/models/headers.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
Interesting Findings: <%= @findings.size %>
|
2
|
-
|
3
2
|
<% @findings.each do |finding| -%>
|
3
|
+
|
4
4
|
[+] <%= finding.url %>
|
5
5
|
| Confidence: <%= finding.confidence %>%
|
6
6
|
| Found By: <%= finding.found_by %>
|
7
7
|
<% unless (confirmed = finding.confirmed_by).empty? -%>
|
8
|
+
<% if confirmed.size == 1 -%>
|
9
|
+
| Confirmed By: <%= confirmed.first.found_by %>, <%= confirmed.first.confidence %>% confidence
|
10
|
+
<% else -%>
|
8
11
|
| Confirmed By:
|
9
12
|
<% confirmed.each do |c| -%>
|
10
13
|
| - <%= c.found_by %>, <%= c.confidence %>% confidence
|
11
14
|
<% end -%>
|
12
15
|
<% end -%>
|
13
|
-
<% unless (entries = finding.interesting_entries).empty? -%>
|
14
|
-
| Interesting Entries:
|
15
|
-
<% entries.each do |entry| -%>
|
16
|
-
| - <%= entry %>
|
17
16
|
<% end -%>
|
18
|
-
|
19
|
-
|
17
|
+
<%= render('_array', a: finding.references, s: 'Reference', p: 'References') -%>
|
18
|
+
<%= render('_array', a: finding.interesting_entries, s: 'Interesting Entry', p: 'Interesting Entries') -%>
|
19
|
+
<% end -%>
|
data/lib/cms_scanner/version.rb
CHANGED
@@ -135,7 +135,7 @@ describe CMSScanner::Controller::Core do
|
|
135
135
|
describe '#after_scan' do
|
136
136
|
let(:keys) { [:verbose, :start_time, :stop_time, :start_memory, :elapsed, :used_memory] }
|
137
137
|
|
138
|
-
it '
|
138
|
+
it 'calls the formatter with the correct parameters' do
|
139
139
|
# Call the #run once to ensure that @start_time & @start_memory are set
|
140
140
|
expect(core).to receive(:output).with('started', url: target_url)
|
141
141
|
core.run
|
@@ -39,7 +39,7 @@ describe CMSScanner::Headers do
|
|
39
39
|
let(:headers) { parse_headers_file(fixture) }
|
40
40
|
|
41
41
|
it 'returns an array with the headers' do
|
42
|
-
@expected = ['Server: nginx/1.1.19', 'X-Article-Id: 12']
|
42
|
+
@expected = ['Server: nginx/1.1.19', 'X-Powered-By: ASP.NET, PHP', 'X-Article-Id: 12']
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'App::Views' do
|
4
|
+
|
5
|
+
let(:target_url) { 'http://ex.lo/' }
|
6
|
+
let(:fixtures) { File.join(SPECS, 'output') }
|
7
|
+
|
8
|
+
# CliNoColour is used to test the CLI output to avoid the painful colours
|
9
|
+
# in the expected output.
|
10
|
+
[:JSON, :CliNoColour].each do |formatter|
|
11
|
+
context "when #{formatter}" do
|
12
|
+
|
13
|
+
it_behaves_like 'App::Views::Core'
|
14
|
+
it_behaves_like 'App::Views::InterestingFiles'
|
15
|
+
|
16
|
+
let(:parsed_options) { { url: target_url, format: formatter.to_s.underscore.dasherize } }
|
17
|
+
|
18
|
+
before do
|
19
|
+
controller.class.parsed_options = parsed_options
|
20
|
+
# Resets the formatter to ensure the correct one is loaded
|
21
|
+
controller.class.class_variable_set(:@@formatter, nil)
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
view_filename = "#{view}.#{formatter.to_s.underscore.downcase}"
|
26
|
+
controller_dir = controller.class.to_s.demodulize.underscore.downcase
|
27
|
+
output = File.read(File.join(fixtures, controller_dir, view_filename))
|
28
|
+
|
29
|
+
expect($stdout).to receive(:puts).with(output)
|
30
|
+
|
31
|
+
controller.output(view, @tpl_vars)
|
32
|
+
controller.formatter.beautify # Mandatory to be able to test formatter such as JSON
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/spec/lib/controller_spec.rb
CHANGED
@@ -5,7 +5,8 @@ describe CMSScanner::Controller do
|
|
5
5
|
subject(:controller) { described_class::Base.new }
|
6
6
|
|
7
7
|
context 'when parsed_options' do
|
8
|
-
before
|
8
|
+
before { described_class::Base.parsed_options = parsed_options }
|
9
|
+
|
9
10
|
let(:parsed_options) { { url: 'http://example.com/' } }
|
10
11
|
|
11
12
|
its(:parsed_options) { should eq(parsed_options) }
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Interesting Findings: 3
|
2
|
+
|
3
|
+
[+] F1
|
4
|
+
| Confidence: 10%
|
5
|
+
| Found By: Spec
|
6
|
+
|
7
|
+
[+] F2
|
8
|
+
| Confidence: 10%
|
9
|
+
| Found By: Spec
|
10
|
+
| Confirmed By: Spec2, 10% confidence
|
11
|
+
| Reference: R1
|
12
|
+
| Interesting Entry: IE1
|
13
|
+
|
14
|
+
[+] F3
|
15
|
+
| Confidence: 10%
|
16
|
+
| Found By: Spec
|
17
|
+
| Confirmed By:
|
18
|
+
| - Spec2, 10% confidence
|
19
|
+
| - Spec3, 10% confidence
|
20
|
+
| References:
|
21
|
+
| - R1
|
22
|
+
| - R2
|
23
|
+
| Interesting Entries:
|
24
|
+
| - IE1
|
25
|
+
| - IE2
|
data/spec/shared_examples.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'shared_examples/browser_actions'
|
3
2
|
require 'shared_examples/formatter_buffer'
|
4
3
|
require 'shared_examples/formatter_class_methods'
|
@@ -9,3 +8,5 @@ require 'shared_examples/target/platform/php'
|
|
9
8
|
require 'shared_examples/target/server/generic'
|
10
9
|
require 'shared_examples/target/server/apache'
|
11
10
|
require 'shared_examples/target/server/iis'
|
11
|
+
require 'shared_examples/views/core'
|
12
|
+
require 'shared_examples/views/interesting_files'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
shared_examples 'App::Views::Core' do
|
3
|
+
|
4
|
+
let(:controller) { CMSScanner::Controller::Core.new }
|
5
|
+
let(:tpl_vars) { { url: target_url, start_time: Time.parse('2014-10-30 13:02:01 +0100') } }
|
6
|
+
|
7
|
+
describe 'started' do
|
8
|
+
let(:view) { 'started' }
|
9
|
+
|
10
|
+
it 'outputs the expected string' do
|
11
|
+
@tpl_vars = tpl_vars.merge(start_memory: 10)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'finished' do
|
16
|
+
let(:view) { 'finished' }
|
17
|
+
|
18
|
+
it 'outputs the expected string' do
|
19
|
+
@tpl_vars = tpl_vars.merge(
|
20
|
+
stop_time: Time.parse('2014-10-30 13:02:03 +0100'),
|
21
|
+
used_memory: 100,
|
22
|
+
elapsed: 3
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
shared_examples 'App::Views::InterestingFiles' do
|
3
|
+
|
4
|
+
let(:controller) { CMSScanner::Controller::InterestingFiles.new }
|
5
|
+
let(:tpl_vars) { { url: target_url } }
|
6
|
+
let(:interesting_file) { CMSScanner::InterestingFile }
|
7
|
+
|
8
|
+
describe 'findings' do
|
9
|
+
let(:view) { 'findings' }
|
10
|
+
let(:opts) { { confidence: 10, found_by: 'Spec' } }
|
11
|
+
|
12
|
+
it 'outputs the expected string' do
|
13
|
+
findings = CMSScanner::Finders::Findings.new <<
|
14
|
+
interesting_file.new('F1', opts) <<
|
15
|
+
interesting_file.new('F2', opts.merge(references: %w(R1), interesting_entries: %w(IE1))) <<
|
16
|
+
interesting_file.new('F2', opts.merge(found_by: 'Spec2')) <<
|
17
|
+
interesting_file.new('F3',
|
18
|
+
opts.merge(references: %w(R1 R2), interesting_entries: %w(IE1 IE2))) <<
|
19
|
+
interesting_file.new('F3', opts.merge(found_by: 'Spec2')) <<
|
20
|
+
interesting_file.new('F3', opts.merge(found_by: 'Spec3'))
|
21
|
+
|
22
|
+
@tpl_vars = tpl_vars.merge(findings: findings)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.
|
4
|
+
version: 0.0.5
|
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: 2014-10-
|
11
|
+
date: 2014-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opt_parse_validator
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- app/models/xml_rpc.rb
|
218
218
|
- app/views/cli/core/finished.erb
|
219
219
|
- app/views/cli/core/started.erb
|
220
|
+
- app/views/cli/interesting_files/_array.erb
|
220
221
|
- app/views/cli/interesting_files/findings.erb
|
221
222
|
- app/views/cli/scan_aborted.erb
|
222
223
|
- app/views/json/core/finished.erb
|
@@ -272,6 +273,7 @@ files:
|
|
272
273
|
- spec/app/models/interesting_file_spec.rb
|
273
274
|
- spec/app/models/robots_txt_spec.rb
|
274
275
|
- spec/app/models/xml_rpc_spec.rb
|
276
|
+
- spec/app/views_spec.rb
|
275
277
|
- spec/cache/.gitignore
|
276
278
|
- spec/dummy_finders.rb
|
277
279
|
- spec/fixtures/interesting_files/fantastico_fileslist/fantastico_fileslist.txt
|
@@ -318,6 +320,12 @@ files:
|
|
318
320
|
- spec/lib/target/servers_spec.rb
|
319
321
|
- spec/lib/target_spec.rb
|
320
322
|
- spec/lib/web_site_spec.rb
|
323
|
+
- spec/output/core/finished.cli_no_colour
|
324
|
+
- spec/output/core/finished.json
|
325
|
+
- spec/output/core/started.cli_no_colour
|
326
|
+
- spec/output/core/started.json
|
327
|
+
- spec/output/interesting_files/findings.cli_no_colour
|
328
|
+
- spec/output/interesting_files/findings.json
|
321
329
|
- spec/shared_examples.rb
|
322
330
|
- spec/shared_examples/browser_actions.rb
|
323
331
|
- spec/shared_examples/finding.rb
|
@@ -330,6 +338,8 @@ files:
|
|
330
338
|
- spec/shared_examples/target/server/apache.rb
|
331
339
|
- spec/shared_examples/target/server/generic.rb
|
332
340
|
- spec/shared_examples/target/server/iis.rb
|
341
|
+
- spec/shared_examples/views/core.rb
|
342
|
+
- spec/shared_examples/views/interesting_files.rb
|
333
343
|
- spec/spec_helper.rb
|
334
344
|
homepage: https://github.com/wpscanteam/CMSScanner
|
335
345
|
licenses:
|
@@ -372,6 +382,7 @@ test_files:
|
|
372
382
|
- spec/app/models/interesting_file_spec.rb
|
373
383
|
- spec/app/models/robots_txt_spec.rb
|
374
384
|
- spec/app/models/xml_rpc_spec.rb
|
385
|
+
- spec/app/views_spec.rb
|
375
386
|
- spec/cache/.gitignore
|
376
387
|
- spec/dummy_finders.rb
|
377
388
|
- spec/fixtures/interesting_files/fantastico_fileslist/fantastico_fileslist.txt
|
@@ -418,6 +429,12 @@ test_files:
|
|
418
429
|
- spec/lib/target/servers_spec.rb
|
419
430
|
- spec/lib/target_spec.rb
|
420
431
|
- spec/lib/web_site_spec.rb
|
432
|
+
- spec/output/core/finished.cli_no_colour
|
433
|
+
- spec/output/core/finished.json
|
434
|
+
- spec/output/core/started.cli_no_colour
|
435
|
+
- spec/output/core/started.json
|
436
|
+
- spec/output/interesting_files/findings.cli_no_colour
|
437
|
+
- spec/output/interesting_files/findings.json
|
421
438
|
- spec/shared_examples.rb
|
422
439
|
- spec/shared_examples/browser_actions.rb
|
423
440
|
- spec/shared_examples/finding.rb
|
@@ -430,4 +447,6 @@ test_files:
|
|
430
447
|
- spec/shared_examples/target/server/apache.rb
|
431
448
|
- spec/shared_examples/target/server/generic.rb
|
432
449
|
- spec/shared_examples/target/server/iis.rb
|
450
|
+
- spec/shared_examples/views/core.rb
|
451
|
+
- spec/shared_examples/views/interesting_files.rb
|
433
452
|
- spec/spec_helper.rb
|