cms_scanner 0.0.4 → 0.0.5

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: 9ef4664292e2b76b62b68005c011ad2556c481f3
4
- data.tar.gz: 837736b39f70241e9a2958974f7184d6b4db13ae
3
+ metadata.gz: a4df8e5a102999fc7c177b6b99e3b2c31b6753a4
4
+ data.tar.gz: 5558b190e7bf8f1b1ea5d13354fdb4ebab2c4b2b
5
5
  SHA512:
6
- metadata.gz: 3c976a3bca14ea5099c5fa8c6260e7b07ae63e792e39896e7a99bb291ef8751a56c08e01e5fed589a85423bf146d25daf8dfd7aa498a0de835adecbf9e3b7741
7
- data.tar.gz: 6a83afe4347b104509ffcd8732494f8f0ef2fe54f114b462df8ab74f2565032e9a2083384ba16d162e249c6b138c8a1fbf6f6b0073b1a910a25eb6b48bd88c0d
6
+ metadata.gz: 4e28abacf6e31208804bbdc0e1f61368bcb598d3460f49940476bc8f878b7f9f9d0f2c9e579551ac15abcac69e49cf14e79848e0fe6256aa6c5f6acc91aef11b
7
+ data.tar.gz: 49c1f25826da617ab18d36241c63cc2b012faef1a9391fa70297ed309c46a4064f5e6deb11bddf91ff7655f885cfa99852f3e88343eaa2872f2bd13275271643
@@ -15,7 +15,7 @@ module CMSScanner
15
15
  entries.each do |header, value|
16
16
  next if known_headers.include?(header.downcase)
17
17
 
18
- results << "#{header}: #{value}"
18
+ results << "#{header}: #{[*value].join(', ')}"
19
19
  end
20
20
  results
21
21
  end
@@ -0,0 +1,10 @@
1
+ <% unless @a.empty? -%>
2
+ <% if @a.size == 1 -%>
3
+ | <%= @s %>: <%= @a.first %>
4
+ <% else -%>
5
+ | <%= @p %>:
6
+ <% @a.each do |line| -%>
7
+ | - <%= line %>
8
+ <% end -%>
9
+ <% end -%>
10
+ <% end -%>
@@ -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
- <% end %>
19
- <% end %>
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 -%>
@@ -1,4 +1,4 @@
1
1
  # Version
2
2
  module CMSScanner
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
@@ -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 'calles the formatter with the correct parameters' do
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
@@ -1,5 +1,7 @@
1
1
  HTTP/1.1 200 OK
2
2
  Server: nginx/1.1.19
3
+ X-Powered-By: ASP.NET
4
+ X-Powered-By: PHP
3
5
  Date: Thu
4
6
  Content-Type: text/plain; charset=utf-8
5
7
  Connection: keep-alive
@@ -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 { described_class::Base.parsed_options = parsed_options }
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,4 @@
1
+
2
+ [+] Finished: Thu Oct 30 13:02:03 2014
3
+ [+] Memory used: 100 B
4
+ [+] Elapsed time: 00:00:03
@@ -0,0 +1,5 @@
1
+ {
2
+ "stop_time": 1414670523,
3
+ "elapsed": 3,
4
+ "used_memory": 100
5
+ }
@@ -0,0 +1,3 @@
1
+ [+] URL: http://ex.lo/
2
+ [+] Started: Thu Oct 30 13:02:01 2014
3
+
@@ -0,0 +1,5 @@
1
+ {
2
+ "start_time": 1414670521,
3
+ "start_memory": 10,
4
+ "target_url": "http://ex.lo/"
5
+ }
@@ -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
@@ -0,0 +1,3 @@
1
+ {
2
+ "todo": "Not yet done"
3
+ }
@@ -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
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-21 00:00:00.000000000 Z
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