cms_scanner 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/core.rb +4 -3
  3. data/app/views/cli/core/finished.erb +1 -0
  4. data/app/views/json/core/finished.erb +1 -0
  5. data/cms_scanner.gemspec +13 -3
  6. data/lib/cms_scanner.rb +14 -2
  7. data/lib/cms_scanner/finders/finder.rb +16 -7
  8. data/lib/cms_scanner/finders/finder/enumerator.rb +4 -28
  9. data/lib/cms_scanner/finders/finder/fingerprinter.rb +60 -0
  10. data/lib/cms_scanner/finders/finding.rb +1 -1
  11. data/lib/cms_scanner/target/scope.rb +4 -1
  12. data/lib/cms_scanner/target/server/generic.rb +1 -1
  13. data/lib/cms_scanner/typhoeus/hydra.rb +10 -0
  14. data/lib/cms_scanner/version.rb +1 -1
  15. metadata +5 -203
  16. data/.gitignore +0 -7
  17. data/.rspec +0 -2
  18. data/.rubocop.yml +0 -10
  19. data/.travis.yml +0 -17
  20. data/Gemfile +0 -6
  21. data/Rakefile +0 -9
  22. data/spec/app/controllers/core_spec.rb +0 -167
  23. data/spec/app/controllers/interesting_files_spec.rb +0 -70
  24. data/spec/app/finders/interesting_files/fantastico_fileslist_spec.rb +0 -66
  25. data/spec/app/finders/interesting_files/headers_spec.rb +0 -36
  26. data/spec/app/finders/interesting_files/robots_txt_spec.rb +0 -54
  27. data/spec/app/finders/interesting_files/search_replace_db_2_spec.rb +0 -53
  28. data/spec/app/finders/interesting_files/xml_rpc_spec.rb +0 -136
  29. data/spec/app/finders/interesting_files_spec.rb +0 -12
  30. data/spec/app/formatters/cli_no_colour_spec.rb +0 -14
  31. data/spec/app/formatters/cli_spec.rb +0 -30
  32. data/spec/app/formatters/json_spec.rb +0 -30
  33. data/spec/app/models/fantastico_fileslist_spec.rb +0 -31
  34. data/spec/app/models/headers_spec.rb +0 -51
  35. data/spec/app/models/interesting_file_spec.rb +0 -69
  36. data/spec/app/models/robots_txt_spec.rb +0 -27
  37. data/spec/app/models/version_spec.rb +0 -51
  38. data/spec/app/models/xml_rpc_spec.rb +0 -46
  39. data/spec/app/views_spec.rb +0 -35
  40. data/spec/cache/.gitignore +0 -4
  41. data/spec/dummy_finding.rb +0 -25
  42. data/spec/dummy_independent_finders.rb +0 -26
  43. data/spec/dummy_unique_finders.rb +0 -33
  44. data/spec/fixtures/finders/interesting_files/fantastico_fileslist/fantastico_fileslist.txt +0 -12
  45. data/spec/fixtures/finders/interesting_files/file.txt +0 -4
  46. data/spec/fixtures/finders/interesting_files/headers/interesting.txt +0 -16
  47. data/spec/fixtures/finders/interesting_files/headers/no_interesting.txt +0 -12
  48. data/spec/fixtures/finders/interesting_files/robots_txt/robots.txt +0 -10
  49. data/spec/fixtures/finders/interesting_files/search_replace_db_2/searchreplacedb2.php +0 -188
  50. data/spec/fixtures/finders/interesting_files/xml_rpc/homepage_in_scope_pingback.html +0 -7
  51. data/spec/fixtures/finders/interesting_files/xml_rpc/homepage_out_of_scope_pingback.html +0 -7
  52. data/spec/fixtures/finders/interesting_files/xml_rpc/xmlrpc.php +0 -1
  53. data/spec/fixtures/output.txt +0 -0
  54. data/spec/fixtures/target/comments.html +0 -29
  55. data/spec/fixtures/target/platform/php/debug_log/debug.log +0 -2
  56. data/spec/fixtures/target/platform/php/fpd/wp_rss_functions.php +0 -2
  57. data/spec/fixtures/target/scope/index.html +0 -23
  58. data/spec/fixtures/target/server/apache/directory_listing/2.2.16.html +0 -15
  59. data/spec/fixtures/target/server/generic/server/apache/basic.txt +0 -5
  60. data/spec/fixtures/target/server/generic/server/iis/basic.txt +0 -6
  61. data/spec/fixtures/target/server/generic/server/not_detected.txt +0 -3
  62. data/spec/fixtures/target/server/iis/directory_listing/no_parent.html +0 -3
  63. data/spec/fixtures/target/server/iis/directory_listing/with_parent.html +0 -3
  64. data/spec/fixtures/views/base/ctrl/local.erb +0 -1
  65. data/spec/fixtures/views/base/ctrl/test.erb +0 -3
  66. data/spec/fixtures/views/base/global.erb +0 -1
  67. data/spec/fixtures/views/base/test.erb +0 -2
  68. data/spec/fixtures/views/based_format/test.erb +0 -1
  69. data/spec/fixtures/views/json/render_me.erb +0 -4
  70. data/spec/lib/browser_spec.rb +0 -140
  71. data/spec/lib/cache/file_store_spec.rb +0 -100
  72. data/spec/lib/cache/typhoeus_spec.rb +0 -28
  73. data/spec/lib/cms_scanner_spec.rb +0 -49
  74. data/spec/lib/controller_spec.rb +0 -30
  75. data/spec/lib/controllers_spec.rb +0 -48
  76. data/spec/lib/finders/confidence_spec.rb +0 -39
  77. data/spec/lib/finders/finder/enumerator_spec.rb +0 -89
  78. data/spec/lib/finders/finder/smart_url_checker/findings_spec.rb +0 -39
  79. data/spec/lib/finders/finder/smart_url_checker_spec.rb +0 -50
  80. data/spec/lib/finders/finder_spec.rb +0 -11
  81. data/spec/lib/finders/findings_spec.rb +0 -36
  82. data/spec/lib/finders/independent_finders_spec.rb +0 -134
  83. data/spec/lib/finders/same_type_finder_spec.rb +0 -24
  84. data/spec/lib/finders/same_type_finders_spec.rb +0 -126
  85. data/spec/lib/finders/unique_finder_spec.rb +0 -24
  86. data/spec/lib/finders/unique_finders_spec.rb +0 -222
  87. data/spec/lib/formatter_spec.rb +0 -145
  88. data/spec/lib/public_suffix/domain_spec.rb +0 -49
  89. data/spec/lib/sub_scanner_spec.rb +0 -45
  90. data/spec/lib/target/hashes_spec.rb +0 -90
  91. data/spec/lib/target/platforms_spec.rb +0 -13
  92. data/spec/lib/target/scope_spec.rb +0 -103
  93. data/spec/lib/target/servers_spec.rb +0 -13
  94. data/spec/lib/target_spec.rb +0 -69
  95. data/spec/lib/vulnerability/references_spec.rb +0 -75
  96. data/spec/lib/vulnerability_spec.rb +0 -27
  97. data/spec/lib/web_site_spec.rb +0 -121
  98. data/spec/output/core/finished.cli_no_colour +0 -3
  99. data/spec/output/core/finished.json +0 -5
  100. data/spec/output/core/started.cli_no_colour +0 -3
  101. data/spec/output/core/started.json +0 -5
  102. data/spec/output/interesting_files/empty.cli_no_colour +0 -2
  103. data/spec/output/interesting_files/empty.json +0 -5
  104. data/spec/output/interesting_files/findings.cli_no_colour +0 -30
  105. data/spec/output/interesting_files/findings.json +0 -75
  106. data/spec/shared_examples.rb +0 -11
  107. data/spec/shared_examples/browser_actions.rb +0 -30
  108. data/spec/shared_examples/finding.rb +0 -54
  109. data/spec/shared_examples/formatter_buffer.rb +0 -6
  110. data/spec/shared_examples/formatter_class_methods.rb +0 -26
  111. data/spec/shared_examples/independent_finder.rb +0 -31
  112. data/spec/shared_examples/target/platform/php.rb +0 -56
  113. data/spec/shared_examples/target/server/apache.rb +0 -32
  114. data/spec/shared_examples/target/server/generic.rb +0 -33
  115. data/spec/shared_examples/target/server/iis.rb +0 -37
  116. data/spec/shared_examples/views/core.rb +0 -26
  117. data/spec/shared_examples/views/interesting_files.rb +0 -36
  118. data/spec/spec_helper.rb +0 -43
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CMSScanner::Vulnerability do
4
- subject(:vuln) { described_class.new(title) }
5
- let(:title) { 'Test Vuln' }
6
-
7
- describe '#new' do
8
- its(:title) { should eql title }
9
- its(:references) { should eql({}) }
10
- its(:type) { should eql nil }
11
- its(:fixed_in) { should eql nil }
12
- end
13
-
14
- describe '#==' do
15
- context 'when te same vuln' do
16
- it 'returns true' do
17
- expect(vuln).to eq vuln.dup
18
- end
19
- end
20
-
21
- context 'when not equal' do
22
- it 'returns false' do
23
- expect(vuln).to_not eq described_class.new('not eq')
24
- end
25
- end
26
- end
27
- end
@@ -1,121 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CMSScanner::WebSite do
4
- subject(:web_site) { described_class.new(url, opts) }
5
- let(:url) { 'http://e.org' }
6
- let(:opts) { {} }
7
-
8
- describe '#url=' do
9
- context 'when the url is incorrect' do
10
- after do
11
- expect { web_site.url = @url }.to raise_error Addressable::URI::InvalidURIError
12
- end
13
-
14
- it 'raises an error if empty' do
15
- @url = ''
16
- end
17
-
18
- it 'raises an error if wrong format' do
19
- @url = 'jj'
20
- end
21
- end
22
-
23
- context 'when valid' do
24
- it 'creates an Addressable object and adds a traling slash' do
25
- web_site.url = 'http://site.com'
26
-
27
- expect(web_site.url).to eq('http://site.com/')
28
- expect(web_site.uri).to be_a Addressable::URI
29
- end
30
- end
31
- end
32
-
33
- describe '#url' do
34
- context 'when no path argument' do
35
- its(:url) { should eql 'http://e.org/' }
36
- end
37
-
38
- context 'when a path argument' do
39
- it 'appends the path' do
40
- expect(web_site.url('file.txt')).to eql "#{url}/file.txt"
41
- end
42
-
43
- it 'encodes the path' do
44
- expect(web_site.url('f ile.txt')).to eql "#{url}/f%20ile.txt"
45
- expect(web_site.url('s/a%.txt')).to eql "#{url}/s/a%25.txt"
46
- expect(web_site.url('#file.txt#')).to eql "#{url}/%23file.txt%23"
47
- end
48
-
49
- context 'when relative path' do
50
- let(:url) { 'http://e.org/dir/' }
51
-
52
- it 'appends it from the host/domain' do
53
- expect(web_site.url('/sub/file.txt')).to eql 'http://e.org/sub/file.txt'
54
- end
55
- end
56
- end
57
- end
58
-
59
- describe '#opts' do
60
- its(:opts) { should eql({}) }
61
-
62
- context 'when opts' do
63
- let(:opts) { { test: 'mm' } }
64
-
65
- its(:opts) { should eql opts }
66
- end
67
- end
68
-
69
- describe '#online?, #http_auth?, #access_forbidden?, #proxy_auth?' do
70
- before { stub_request(:get, web_site.url(path)).to_return(status: status) }
71
-
72
- [nil, 'file-path.txt'].each do |p|
73
- context "when path = #{p}" do
74
- let(:path) { p }
75
-
76
- context 'when response status is a 200' do
77
- let(:status) { 200 }
78
-
79
- it 'is considered fine' do
80
- expect(web_site.online?(path)).to be true
81
- expect(web_site.http_auth?(path)).to be false
82
- expect(web_site.access_forbidden?(path)).to be false
83
- expect(web_site.proxy_auth?(path)).to be false
84
- end
85
- end
86
-
87
- context 'when offline' do
88
- let(:status) { 0 }
89
-
90
- it 'returns false' do
91
- expect(web_site.online?(path)).to be false
92
- end
93
- end
94
-
95
- context 'when http auth required' do
96
- let(:status) { 401 }
97
-
98
- it 'returns true' do
99
- expect(web_site.http_auth?(path)).to be true
100
- end
101
- end
102
-
103
- context 'when access is forbidden' do
104
- let(:status) { 403 }
105
-
106
- it 'return true' do
107
- expect(web_site.access_forbidden?(path)).to be true
108
- end
109
- end
110
-
111
- context 'when proxy auth required' do
112
- let(:status) { 407 }
113
-
114
- it 'returns true' do
115
- expect(web_site.proxy_auth?(path)).to be true
116
- end
117
- end
118
- end
119
- end
120
- end
121
- end
@@ -1,3 +0,0 @@
1
- [+] Finished: Thu Oct 30 12:02:03 2014
2
- [+] Memory used: 100 B
3
- [+] Elapsed time: 00:00:02
@@ -1,5 +0,0 @@
1
- {
2
- "stop_time": 1414670523,
3
- "elapsed": 2,
4
- "used_memory": 100
5
- }
@@ -1,3 +0,0 @@
1
- [+] URL: http://e.org/
2
- [+] Started: Thu Oct 30 12:02:01 2014
3
-
@@ -1,5 +0,0 @@
1
- {
2
- "start_time": 1414670521,
3
- "start_memory": 10,
4
- "target_url": "http://e.org/"
5
- }
@@ -1,2 +0,0 @@
1
- Interesting Findings: 0
2
-
@@ -1,5 +0,0 @@
1
- {
2
- "interesting_files": [
3
-
4
- ]
5
- }
@@ -1,30 +0,0 @@
1
- Interesting Findings: 4
2
-
3
- [+] F1
4
- | Confidence: 10%
5
- | Found By: Spec
6
-
7
- [+] F2
8
- | Confidence: 13%
9
- | Found By: Spec
10
- | Confirmed By: Spec2, 10% confidence
11
- | Reference: R1
12
- | Interesting Entry: IE1
13
-
14
- [+] F3
15
- | Confidence: 100%
16
- | Found By: Spec
17
- | Confirmed By:
18
- | - Spec2, 100% confidence
19
- | - Spec3, 10% confidence
20
- | References:
21
- | - R1
22
- | - R2
23
- | Interesting Entries:
24
- | - IE1
25
- | - IE2
26
-
27
- [+] F4
28
- | Found By: Spec
29
- | Confirmed By: Spec2
30
-
@@ -1,75 +0,0 @@
1
- {
2
- "interesting_files": [
3
- {
4
- "F1": {
5
- "found_by": "Spec",
6
- "confidence": 10,
7
- "confirmed_by": [
8
-
9
- ],
10
- "references": [
11
-
12
- ],
13
- "interesting_entries": [
14
-
15
- ]
16
- },
17
- "F2": {
18
- "found_by": "Spec",
19
- "confidence": 13,
20
- "confirmed_by": [
21
- {
22
- "Spec2": {
23
- "confidence": 10
24
- }
25
- }
26
- ],
27
- "references": [
28
- "R1"
29
- ],
30
- "interesting_entries": [
31
- "IE1"
32
- ]
33
- },
34
- "F3": {
35
- "found_by": "Spec",
36
- "confidence": 100,
37
- "confirmed_by": [
38
- {
39
- "Spec2": {
40
- "confidence": 100
41
- },
42
- "Spec3": {
43
- "confidence": 10
44
- }
45
- }
46
- ],
47
- "references": [
48
- "R1",
49
- "R2"
50
- ],
51
- "interesting_entries": [
52
- "IE1",
53
- "IE2"
54
- ]
55
- },
56
- "F4": {
57
- "found_by": "Spec",
58
- "confidence": 0,
59
- "confirmed_by": [
60
- {
61
- "Spec2": {
62
- "confidence": 0
63
- }
64
- }
65
- ],
66
- "references": [
67
-
68
- ],
69
- "interesting_entries": [
70
-
71
- ]
72
- }
73
- }
74
- ]
75
- }
@@ -1,11 +0,0 @@
1
- require 'shared_examples/browser_actions'
2
- require 'shared_examples/formatter_buffer'
3
- require 'shared_examples/formatter_class_methods'
4
- require 'shared_examples/finding'
5
- require 'shared_examples/independent_finder'
6
- require 'shared_examples/target/platform/php'
7
- require 'shared_examples/target/server/generic'
8
- require 'shared_examples/target/server/apache'
9
- require 'shared_examples/target/server/iis'
10
- require 'shared_examples/views/core'
11
- require 'shared_examples/views/interesting_files'
@@ -1,30 +0,0 @@
1
-
2
- shared_examples CMSScanner::Browser::Actions do
3
- let(:url) { 'http://example.com/file.txt' }
4
- let(:browser) { CMSScanner::Browser }
5
-
6
- describe '#get, #post, #head' do
7
- [:get, :post, :head].each do |method|
8
- it 'calls the method and returns a Typhoeus::Response' do
9
- stub_request(method, url)
10
-
11
- expect(browser.send(method, url)).to be_a Typhoeus::Response
12
- end
13
- end
14
- end
15
-
16
- describe '#get_and_follow_location' do
17
- let(:redirection) { 'http://redirect.me' }
18
-
19
- it 'follows the location' do
20
- stub_request(:get, url).to_return(status: 301, headers: { location: redirection })
21
- stub_request(:get, redirection).to_return(status: 200, body: 'Got me')
22
-
23
- response = browser.get_and_follow_location(url)
24
- expect(response).to be_a Typhoeus::Response
25
- # Line below is not working due to an issue in Typhoeus/Webmock
26
- # See https://github.com/typhoeus/typhoeus/issues/279
27
- # expect(response.body).to eq 'Got me'
28
- end
29
- end
30
- end
@@ -1,54 +0,0 @@
1
-
2
- shared_examples CMSScanner::Finders::Finding do
3
- [:references, :confirmed_by, :interesting_entries].each do |opt|
4
- describe "##{opt}" do
5
- its(opt) { should eq [] }
6
-
7
- context 'when supplied in the #new' do
8
- let(:opts) { { opt => 'test' } }
9
-
10
- its(opt) { should eq 'test' }
11
- end
12
- end
13
- end
14
-
15
- describe '#confidence, #confidence=' do
16
- its(:confidence) { should eql 0 }
17
-
18
- context 'when already set' do
19
- before { subject.confidence = 10 }
20
-
21
- its(:confidence) { should eql 10 }
22
- end
23
- end
24
-
25
- describe '#parse_finding_options' do
26
- xit
27
- end
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
50
-
51
- describe '#<=>' do
52
- # Handled in spc/app/models/interesting_files_spec
53
- end
54
- end
@@ -1,6 +0,0 @@
1
-
2
- shared_examples CMSScanner::Formatter::Buffer do
3
- describe '#buffer' do
4
- its(:buffer) { should be_empty }
5
- end
6
- end
@@ -1,26 +0,0 @@
1
-
2
- shared_examples CMSScanner::Formatter::ClassMethods do
3
- describe '#load' do
4
- context 'w/o parameter' do
5
- it 'loads the default formatter' do
6
- expect(subject.load).to be_a subject::Cli
7
- end
8
- end
9
-
10
- it 'loads the correct formatter' do
11
- expect(subject.load('cli_no_colour')).to be_a subject::CliNoColour
12
- end
13
-
14
- it 'adds the custom_views' do
15
- formatter = subject.load(nil, %w(/path/views1 /path2/views))
16
-
17
- expect(formatter.views_directories).to include('/path/views1', '/path2/views')
18
- end
19
- end
20
-
21
- describe '#availables' do
22
- it 'returns the right list' do
23
- expect(subject.availables).to match_array(%w(json cli-no-colour cli))
24
- end
25
- end
26
- end
@@ -1,31 +0,0 @@
1
-
2
- shared_examples CMSScanner::Finders::IndependentFinder do
3
- describe '::find' do
4
- it 'creates a new object and call finders#find' do
5
- created = described_class.new(target)
6
-
7
- expect(described_class).to receive(:new).and_return(created)
8
- expect(created).to receive(:find)
9
-
10
- described_class.find(target)
11
- end
12
- end
13
-
14
- describe '#find' do
15
- it 'calls finders#run' do
16
- expect(subject.finders).to receive(:run).with({})
17
- subject.find
18
- end
19
- end
20
-
21
- describe '#finders' do
22
- its(:finders) { should be_a expected_finders_class }
23
-
24
- it 'returns the correct finders' do
25
- finders = subject.finders
26
-
27
- expect(finders.size).to eq expected_finders.size
28
- expect(finders.map { |f| f.class.to_s.demodulize }).to eq expected_finders
29
- end
30
- end
31
- end