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.
- checksums.yaml +4 -4
- data/app/controllers/core.rb +4 -3
- data/app/views/cli/core/finished.erb +1 -0
- data/app/views/json/core/finished.erb +1 -0
- data/cms_scanner.gemspec +13 -3
- data/lib/cms_scanner.rb +14 -2
- data/lib/cms_scanner/finders/finder.rb +16 -7
- data/lib/cms_scanner/finders/finder/enumerator.rb +4 -28
- data/lib/cms_scanner/finders/finder/fingerprinter.rb +60 -0
- data/lib/cms_scanner/finders/finding.rb +1 -1
- data/lib/cms_scanner/target/scope.rb +4 -1
- data/lib/cms_scanner/target/server/generic.rb +1 -1
- data/lib/cms_scanner/typhoeus/hydra.rb +10 -0
- data/lib/cms_scanner/version.rb +1 -1
- metadata +5 -203
- data/.gitignore +0 -7
- data/.rspec +0 -2
- data/.rubocop.yml +0 -10
- data/.travis.yml +0 -17
- data/Gemfile +0 -6
- data/Rakefile +0 -9
- data/spec/app/controllers/core_spec.rb +0 -167
- data/spec/app/controllers/interesting_files_spec.rb +0 -70
- data/spec/app/finders/interesting_files/fantastico_fileslist_spec.rb +0 -66
- data/spec/app/finders/interesting_files/headers_spec.rb +0 -36
- data/spec/app/finders/interesting_files/robots_txt_spec.rb +0 -54
- data/spec/app/finders/interesting_files/search_replace_db_2_spec.rb +0 -53
- data/spec/app/finders/interesting_files/xml_rpc_spec.rb +0 -136
- data/spec/app/finders/interesting_files_spec.rb +0 -12
- data/spec/app/formatters/cli_no_colour_spec.rb +0 -14
- data/spec/app/formatters/cli_spec.rb +0 -30
- data/spec/app/formatters/json_spec.rb +0 -30
- data/spec/app/models/fantastico_fileslist_spec.rb +0 -31
- data/spec/app/models/headers_spec.rb +0 -51
- data/spec/app/models/interesting_file_spec.rb +0 -69
- data/spec/app/models/robots_txt_spec.rb +0 -27
- data/spec/app/models/version_spec.rb +0 -51
- data/spec/app/models/xml_rpc_spec.rb +0 -46
- data/spec/app/views_spec.rb +0 -35
- data/spec/cache/.gitignore +0 -4
- data/spec/dummy_finding.rb +0 -25
- data/spec/dummy_independent_finders.rb +0 -26
- data/spec/dummy_unique_finders.rb +0 -33
- data/spec/fixtures/finders/interesting_files/fantastico_fileslist/fantastico_fileslist.txt +0 -12
- data/spec/fixtures/finders/interesting_files/file.txt +0 -4
- data/spec/fixtures/finders/interesting_files/headers/interesting.txt +0 -16
- data/spec/fixtures/finders/interesting_files/headers/no_interesting.txt +0 -12
- data/spec/fixtures/finders/interesting_files/robots_txt/robots.txt +0 -10
- data/spec/fixtures/finders/interesting_files/search_replace_db_2/searchreplacedb2.php +0 -188
- data/spec/fixtures/finders/interesting_files/xml_rpc/homepage_in_scope_pingback.html +0 -7
- data/spec/fixtures/finders/interesting_files/xml_rpc/homepage_out_of_scope_pingback.html +0 -7
- data/spec/fixtures/finders/interesting_files/xml_rpc/xmlrpc.php +0 -1
- data/spec/fixtures/output.txt +0 -0
- data/spec/fixtures/target/comments.html +0 -29
- data/spec/fixtures/target/platform/php/debug_log/debug.log +0 -2
- data/spec/fixtures/target/platform/php/fpd/wp_rss_functions.php +0 -2
- data/spec/fixtures/target/scope/index.html +0 -23
- data/spec/fixtures/target/server/apache/directory_listing/2.2.16.html +0 -15
- data/spec/fixtures/target/server/generic/server/apache/basic.txt +0 -5
- data/spec/fixtures/target/server/generic/server/iis/basic.txt +0 -6
- data/spec/fixtures/target/server/generic/server/not_detected.txt +0 -3
- data/spec/fixtures/target/server/iis/directory_listing/no_parent.html +0 -3
- data/spec/fixtures/target/server/iis/directory_listing/with_parent.html +0 -3
- data/spec/fixtures/views/base/ctrl/local.erb +0 -1
- data/spec/fixtures/views/base/ctrl/test.erb +0 -3
- data/spec/fixtures/views/base/global.erb +0 -1
- data/spec/fixtures/views/base/test.erb +0 -2
- data/spec/fixtures/views/based_format/test.erb +0 -1
- data/spec/fixtures/views/json/render_me.erb +0 -4
- data/spec/lib/browser_spec.rb +0 -140
- data/spec/lib/cache/file_store_spec.rb +0 -100
- data/spec/lib/cache/typhoeus_spec.rb +0 -28
- data/spec/lib/cms_scanner_spec.rb +0 -49
- data/spec/lib/controller_spec.rb +0 -30
- data/spec/lib/controllers_spec.rb +0 -48
- data/spec/lib/finders/confidence_spec.rb +0 -39
- data/spec/lib/finders/finder/enumerator_spec.rb +0 -89
- data/spec/lib/finders/finder/smart_url_checker/findings_spec.rb +0 -39
- data/spec/lib/finders/finder/smart_url_checker_spec.rb +0 -50
- data/spec/lib/finders/finder_spec.rb +0 -11
- data/spec/lib/finders/findings_spec.rb +0 -36
- data/spec/lib/finders/independent_finders_spec.rb +0 -134
- data/spec/lib/finders/same_type_finder_spec.rb +0 -24
- data/spec/lib/finders/same_type_finders_spec.rb +0 -126
- data/spec/lib/finders/unique_finder_spec.rb +0 -24
- data/spec/lib/finders/unique_finders_spec.rb +0 -222
- data/spec/lib/formatter_spec.rb +0 -145
- data/spec/lib/public_suffix/domain_spec.rb +0 -49
- data/spec/lib/sub_scanner_spec.rb +0 -45
- data/spec/lib/target/hashes_spec.rb +0 -90
- data/spec/lib/target/platforms_spec.rb +0 -13
- data/spec/lib/target/scope_spec.rb +0 -103
- data/spec/lib/target/servers_spec.rb +0 -13
- data/spec/lib/target_spec.rb +0 -69
- data/spec/lib/vulnerability/references_spec.rb +0 -75
- data/spec/lib/vulnerability_spec.rb +0 -27
- data/spec/lib/web_site_spec.rb +0 -121
- data/spec/output/core/finished.cli_no_colour +0 -3
- data/spec/output/core/finished.json +0 -5
- data/spec/output/core/started.cli_no_colour +0 -3
- data/spec/output/core/started.json +0 -5
- data/spec/output/interesting_files/empty.cli_no_colour +0 -2
- data/spec/output/interesting_files/empty.json +0 -5
- data/spec/output/interesting_files/findings.cli_no_colour +0 -30
- data/spec/output/interesting_files/findings.json +0 -75
- data/spec/shared_examples.rb +0 -11
- data/spec/shared_examples/browser_actions.rb +0 -30
- data/spec/shared_examples/finding.rb +0 -54
- data/spec/shared_examples/formatter_buffer.rb +0 -6
- data/spec/shared_examples/formatter_class_methods.rb +0 -26
- data/spec/shared_examples/independent_finder.rb +0 -31
- data/spec/shared_examples/target/platform/php.rb +0 -56
- data/spec/shared_examples/target/server/apache.rb +0 -32
- data/spec/shared_examples/target/server/generic.rb +0 -33
- data/spec/shared_examples/target/server/iis.rb +0 -37
- data/spec/shared_examples/views/core.rb +0 -26
- data/spec/shared_examples/views/interesting_files.rb +0 -36
- 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
|
data/spec/lib/web_site_spec.rb
DELETED
@@ -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,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
|
-
}
|
data/spec/shared_examples.rb
DELETED
@@ -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,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
|