cms_scanner 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/finders/interesting_files/xml_rpc.rb +1 -3
  3. data/app/models.rb +1 -0
  4. data/app/models/interesting_file.rb +0 -4
  5. data/app/models/version.rb +17 -0
  6. data/app/views/cli/core/finished.erb +0 -1
  7. data/app/views/cli/interesting_files/findings.erb +1 -1
  8. data/cms_scanner.gemspec +2 -2
  9. data/lib/cms_scanner.rb +1 -0
  10. data/lib/cms_scanner/finders.rb +2 -0
  11. data/lib/cms_scanner/finders/finding.rb +4 -0
  12. data/lib/cms_scanner/finders/independent_finders.rb +1 -1
  13. data/lib/cms_scanner/finders/unique_finder.rb +17 -0
  14. data/lib/cms_scanner/finders/unique_finders.rb +39 -0
  15. data/lib/cms_scanner/target.rb +1 -0
  16. data/lib/cms_scanner/target/platform/wordpress.rb +2 -4
  17. data/lib/cms_scanner/target/platform/wordpress/custom_directories.rb +1 -2
  18. data/lib/cms_scanner/target/server/apache.rb +3 -2
  19. data/lib/cms_scanner/target/server/iis.rb +1 -2
  20. data/lib/cms_scanner/typhoeus/response.rb +9 -0
  21. data/lib/cms_scanner/version.rb +1 -1
  22. data/spec/app/controllers/core_spec.rb +0 -2
  23. data/spec/app/controllers/interesting_files_spec.rb +0 -2
  24. data/spec/app/finders/interesting_files/fantastico_fileslist_spec.rb +0 -2
  25. data/spec/app/finders/interesting_files/headers_spec.rb +0 -2
  26. data/spec/app/finders/interesting_files/robots_txt_spec.rb +0 -2
  27. data/spec/app/finders/interesting_files/search_replace_db_2_spec.rb +0 -2
  28. data/spec/app/finders/interesting_files/xml_rpc_spec.rb +0 -2
  29. data/spec/app/finders/interesting_files_spec.rb +1 -2
  30. data/spec/app/formatters/cli_no_colour_spec.rb +0 -2
  31. data/spec/app/formatters/cli_spec.rb +0 -2
  32. data/spec/app/formatters/json_spec.rb +0 -2
  33. data/spec/app/models/fantastico_fileslist_spec.rb +0 -1
  34. data/spec/app/models/headers_spec.rb +0 -1
  35. data/spec/app/models/interesting_file_spec.rb +0 -2
  36. data/spec/app/models/robots_txt_spec.rb +0 -1
  37. data/spec/app/models/version_spec.rb +23 -0
  38. data/spec/app/models/xml_rpc_spec.rb +0 -1
  39. data/spec/app/views_spec.rb +0 -2
  40. data/spec/dummy_finding.rb +21 -0
  41. data/spec/dummy_independent_finders.rb +25 -0
  42. data/spec/dummy_unique_finders.rb +32 -0
  43. data/spec/lib/browser_spec.rb +0 -1
  44. data/spec/lib/cache/file_store_spec.rb +0 -1
  45. data/spec/lib/cache/typhoeus_spec.rb +0 -2
  46. data/spec/lib/cms_scanner_spec.rb +0 -1
  47. data/spec/lib/controller_spec.rb +0 -2
  48. data/spec/lib/controllers_spec.rb +0 -2
  49. data/spec/lib/finders/findings_spec.rb +1 -3
  50. data/spec/lib/finders/independent_finders_spec.rb +4 -6
  51. data/spec/lib/finders/unique_finder_spec.rb +24 -0
  52. data/spec/lib/finders/unique_finders_spec.rb +133 -0
  53. data/spec/lib/formatter_spec.rb +0 -3
  54. data/spec/lib/target_spec.rb +0 -2
  55. data/spec/lib/web_site_spec.rb +0 -3
  56. data/spec/output/core/finished.cli_no_colour +0 -1
  57. data/spec/output/interesting_files/empty.cli_no_colour +1 -0
  58. data/spec/output/interesting_files/findings.cli_no_colour +1 -0
  59. data/spec/shared_examples/browser_actions.rb +0 -2
  60. data/spec/shared_examples/finding.rb +21 -1
  61. data/spec/shared_examples/formatter_buffer.rb +0 -2
  62. data/spec/shared_examples/independent_finder.rb +1 -3
  63. data/spec/shared_examples/target/platform/php.rb +0 -1
  64. data/spec/shared_examples/target/platform/wordpress.rb +0 -2
  65. data/spec/shared_examples/target/server/apache.rb +0 -1
  66. data/spec/shared_examples/target/server/generic.rb +0 -1
  67. data/spec/shared_examples/target/server/iis.rb +0 -1
  68. data/spec/shared_examples/views/core.rb +0 -1
  69. data/spec/shared_examples/views/interesting_files.rb +0 -1
  70. metadata +21 -7
  71. data/spec/dummy_finders.rb +0 -41
@@ -27,7 +27,6 @@ module CMSScanner
27
27
  end
28
28
 
29
29
  describe CMSScanner::Formatter::Base do
30
-
31
30
  subject(:formatter) { described_class.new }
32
31
 
33
32
  describe '#format' do
@@ -114,7 +113,6 @@ describe CMSScanner::Formatter::Base do
114
113
  @tpl = 'local'
115
114
  end
116
115
  end
117
-
118
116
  end
119
117
 
120
118
  describe '#views_directories' do
@@ -132,5 +130,4 @@ describe CMSScanner::Formatter::Base do
132
130
  end
133
131
  end
134
132
  end
135
-
136
133
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CMSScanner::Target do
4
-
5
4
  subject(:target) { described_class.new(url) }
6
5
  let(:url) { 'http://ex.lo' }
7
6
 
@@ -46,5 +45,4 @@ describe CMSScanner::Target do
46
45
  end
47
46
  end
48
47
  end
49
-
50
48
  end
@@ -1,13 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CMSScanner::WebSite do
4
-
5
4
  subject(:web_site) { described_class.new(url) }
6
5
  let(:url) { 'http://ex.lo' }
7
6
 
8
7
  describe '#url=' do
9
8
  context 'when the url is incorrect' do
10
-
11
9
  after do
12
10
  expect { web_site.url = @url }.to raise_error Addressable::URI::InvalidURIError
13
11
  end
@@ -120,5 +118,4 @@ describe CMSScanner::WebSite do
120
118
  end
121
119
  end
122
120
  end
123
-
124
121
  end
@@ -1,4 +1,3 @@
1
-
2
1
  [+] Finished: Thu Oct 30 12:02:03 2014
3
2
  [+] Memory used: 100 B
4
3
  [+] Elapsed time: 00:00:02
@@ -1 +1,2 @@
1
1
  Interesting Findings: 0
2
+
@@ -27,3 +27,4 @@ Interesting Findings: 4
27
27
  [+] F4
28
28
  | Found By: Spec
29
29
  | Confirmed By: Spec2
30
+
@@ -1,6 +1,5 @@
1
1
 
2
2
  shared_examples CMSScanner::Browser::Actions do
3
-
4
3
  let(:url) { 'http://example.com/file.txt' }
5
4
  let(:browser) { CMSScanner::Browser }
6
5
 
@@ -28,5 +27,4 @@ shared_examples CMSScanner::Browser::Actions do
28
27
  # expect(response.body).to eq 'Got me'
29
28
  end
30
29
  end
31
-
32
30
  end
@@ -1,6 +1,5 @@
1
1
 
2
2
  shared_examples CMSScanner::Finders::Finding do
3
-
4
3
  [:references, :confirmed_by, :interesting_entries].each do |opt|
5
4
  describe "##{opt}" do
6
5
  its(opt) { should eq [] }
@@ -27,4 +26,25 @@ shared_examples CMSScanner::Finders::Finding do
27
26
  xit
28
27
  end
29
28
 
29
+ describe '#eql?' do
30
+ before do
31
+ subject.confidence = 10
32
+ subject.found_by = 'test'
33
+ end
34
+
35
+ context 'when eql' do
36
+ it 'returns true' do
37
+ expect(subject).to eql subject
38
+ end
39
+ end
40
+
41
+ context 'when not eql' do
42
+ it 'returns false' do
43
+ other = subject.dup
44
+ other.confidence = 20
45
+
46
+ expect(subject).to_not eql other
47
+ end
48
+ end
49
+ end
30
50
  end
@@ -1,8 +1,6 @@
1
1
 
2
2
  shared_examples CMSScanner::Formatter::Buffer do
3
-
4
3
  describe '#buffer' do
5
4
  its(:buffer) { should be_empty }
6
5
  end
7
-
8
6
  end
@@ -1,6 +1,5 @@
1
1
 
2
2
  shared_examples CMSScanner::Finders::IndependentFinder do
3
-
4
3
  describe '::find' do
5
4
  it 'creates a new object and call finders#find' do
6
5
  created = described_class.new(target)
@@ -20,7 +19,7 @@ shared_examples CMSScanner::Finders::IndependentFinder do
20
19
  end
21
20
 
22
21
  describe '#finders' do
23
- its(:finders) { should be_a CMSScanner::Finders::IndependentFinders }
22
+ its(:finders) { should be_a expected_finders_class }
24
23
 
25
24
  it 'returns the correct finders' do
26
25
  finders = subject.finders
@@ -29,5 +28,4 @@ shared_examples CMSScanner::Finders::IndependentFinder do
29
28
  expect(finders.map { |f| f.class.to_s.demodulize }).to eq expected_finders
30
29
  end
31
30
  end
32
-
33
31
  end
@@ -1,6 +1,5 @@
1
1
 
2
2
  shared_examples CMSScanner::Target::Platform::PHP do
3
-
4
3
  before { stub_request(:get, target.url(path)).to_return(body: body) }
5
4
 
6
5
  describe '#debug_log?' do
@@ -1,7 +1,6 @@
1
1
  require_relative 'wordpress/custom_directories'
2
2
 
3
3
  shared_examples CMSScanner::Target::Platform::WordPress do
4
-
5
4
  it_behaves_like 'WordPress::CustomDirectories'
6
5
 
7
6
  describe '#wordpress?' do
@@ -37,5 +36,4 @@ shared_examples CMSScanner::Target::Platform::WordPress do
37
36
  its(:wordpress_hosted?) { should be true }
38
37
  end
39
38
  end
40
-
41
39
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  shared_examples CMSScanner::Target::Server::Apache do
4
-
5
4
  describe '#server' do
6
5
  its(:server) { should eq :Apache }
7
6
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  shared_examples CMSScanner::Target::Server::Generic do
4
-
5
4
  describe '#server' do
6
5
  before { stub_request(:head, target.url).to_return(headers: parse_headers_file(fixture)) }
7
6
 
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  shared_examples CMSScanner::Target::Server::IIS do
4
-
5
4
  describe '#server' do
6
5
  its(:server) { should eq :IIS }
7
6
  end
@@ -1,6 +1,5 @@
1
1
 
2
2
  shared_examples 'App::Views::Core' do
3
-
4
3
  let(:controller) { CMSScanner::Controller::Core.new }
5
4
  let(:start) { Time.at(1_414_670_521).in_time_zone('Europe/London') }
6
5
  let(:tpl_vars) { { url: target_url, start_time: start } }
@@ -1,6 +1,5 @@
1
1
 
2
2
  shared_examples 'App::Views::InterestingFiles' do
3
-
4
3
  let(:controller) { CMSScanner::Controller::InterestingFiles.new }
5
4
  let(:tpl_vars) { { url: target_url } }
6
5
  let(:interesting_file) { CMSScanner::InterestingFile }
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
- - WPScanTeam - Erwan le Rousseau
7
+ - WPScanTeam - Erwan Le Rousseau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2014-12-16 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: '0.27'
145
+ version: '0.28'
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: '0.27'
152
+ version: '0.28'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: webmock
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -214,6 +214,7 @@ files:
214
214
  - app/models/headers.rb
215
215
  - app/models/interesting_file.rb
216
216
  - app/models/robots_txt.rb
217
+ - app/models/version.rb
217
218
  - app/models/xml_rpc.rb
218
219
  - app/views/cli/core/finished.erb
219
220
  - app/views/cli/core/started.erb
@@ -243,6 +244,8 @@ files:
243
244
  - lib/cms_scanner/finders/findings.rb
244
245
  - lib/cms_scanner/finders/independent_finder.rb
245
246
  - lib/cms_scanner/finders/independent_finders.rb
247
+ - lib/cms_scanner/finders/unique_finder.rb
248
+ - lib/cms_scanner/finders/unique_finders.rb
246
249
  - lib/cms_scanner/formatter.rb
247
250
  - lib/cms_scanner/formatter/buffer.rb
248
251
  - lib/cms_scanner/target.rb
@@ -254,6 +257,7 @@ files:
254
257
  - lib/cms_scanner/target/server/apache.rb
255
258
  - lib/cms_scanner/target/server/generic.rb
256
259
  - lib/cms_scanner/target/server/iis.rb
260
+ - lib/cms_scanner/typhoeus/response.rb
257
261
  - lib/cms_scanner/version.rb
258
262
  - lib/cms_scanner/web_site.rb
259
263
  - lib/helper.rb
@@ -272,10 +276,13 @@ files:
272
276
  - spec/app/models/headers_spec.rb
273
277
  - spec/app/models/interesting_file_spec.rb
274
278
  - spec/app/models/robots_txt_spec.rb
279
+ - spec/app/models/version_spec.rb
275
280
  - spec/app/models/xml_rpc_spec.rb
276
281
  - spec/app/views_spec.rb
277
282
  - spec/cache/.gitignore
278
- - spec/dummy_finders.rb
283
+ - spec/dummy_finding.rb
284
+ - spec/dummy_independent_finders.rb
285
+ - spec/dummy_unique_finders.rb
279
286
  - spec/fixtures/interesting_files/fantastico_fileslist/fantastico_fileslist.txt
280
287
  - spec/fixtures/interesting_files/file.txt
281
288
  - spec/fixtures/interesting_files/headers/interesting.txt
@@ -314,6 +321,8 @@ files:
314
321
  - spec/lib/controllers_spec.rb
315
322
  - spec/lib/finders/findings_spec.rb
316
323
  - spec/lib/finders/independent_finders_spec.rb
324
+ - spec/lib/finders/unique_finder_spec.rb
325
+ - spec/lib/finders/unique_finders_spec.rb
317
326
  - spec/lib/formatter_spec.rb
318
327
  - spec/lib/sub_scanner_spec.rb
319
328
  - spec/lib/target/platforms_spec.rb
@@ -383,10 +392,13 @@ test_files:
383
392
  - spec/app/models/headers_spec.rb
384
393
  - spec/app/models/interesting_file_spec.rb
385
394
  - spec/app/models/robots_txt_spec.rb
395
+ - spec/app/models/version_spec.rb
386
396
  - spec/app/models/xml_rpc_spec.rb
387
397
  - spec/app/views_spec.rb
388
398
  - spec/cache/.gitignore
389
- - spec/dummy_finders.rb
399
+ - spec/dummy_finding.rb
400
+ - spec/dummy_independent_finders.rb
401
+ - spec/dummy_unique_finders.rb
390
402
  - spec/fixtures/interesting_files/fantastico_fileslist/fantastico_fileslist.txt
391
403
  - spec/fixtures/interesting_files/file.txt
392
404
  - spec/fixtures/interesting_files/headers/interesting.txt
@@ -425,6 +437,8 @@ test_files:
425
437
  - spec/lib/controllers_spec.rb
426
438
  - spec/lib/finders/findings_spec.rb
427
439
  - spec/lib/finders/independent_finders_spec.rb
440
+ - spec/lib/finders/unique_finder_spec.rb
441
+ - spec/lib/finders/unique_finders_spec.rb
428
442
  - spec/lib/formatter_spec.rb
429
443
  - spec/lib/sub_scanner_spec.rb
430
444
  - spec/lib/target/platforms_spec.rb
@@ -1,41 +0,0 @@
1
- module CMSScanner
2
- # Dummy Finding
3
- class DummyFinding
4
- include Finders::Finding
5
-
6
- attr_reader :r
7
-
8
- def initialize(r, opts = {})
9
- @r = r
10
- parse_finding_options(opts)
11
- end
12
-
13
- def ==(other)
14
- r == other.r
15
- end
16
-
17
- def eql?(other)
18
- r == other.r && confidence == other.confidence && found_by == other.found_by
19
- end
20
- end
21
-
22
- module Finders
23
- # Dummy Test Finder
24
- class DummyFinder < Finder
25
- def passive(_opts = {})
26
- DummyFinding.new('test', found_by: found_by)
27
- end
28
-
29
- def aggressive(_opts = {})
30
- DummyFinding.new('test', confidence: 100, found_by: 'override')
31
- end
32
- end
33
-
34
- # No aggressive result finder
35
- class NoAggressiveResult < Finder
36
- def passive(_opts = {})
37
- DummyFinding.new('spotted', confidence: 10, found_by: found_by)
38
- end
39
- end
40
- end
41
- end