Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/spec/app/finders/interesting_findings/debug_log_spec.rb
1483 views
1
# frozen_string_literal: true
2
3
describe WPScan::Finders::InterestingFindings::DebugLog do
4
subject(:finder) { described_class.new(target) }
5
let(:target) { WPScan::Target.new(url) }
6
let(:url) { 'http://ex.lo/' }
7
let(:fixtures) { FINDERS_FIXTURES.join('interesting_findings', 'debug_log') }
8
let(:wp_content) { 'wp-content' }
9
let(:log_url) { target.url("#{wp_content}/debug.log") }
10
11
before do
12
expect(target).to receive(:head_or_get_params).and_return(method: :head)
13
expect(target).to receive(:content_dir).at_least(1).and_return(wp_content)
14
end
15
16
describe '#aggressive' do
17
before do
18
stub_request(:head, log_url)
19
stub_request(:get, log_url).to_return(body: body)
20
end
21
22
context 'when empty file' do
23
let(:body) { '' }
24
25
its(:aggressive) { should be_nil }
26
end
27
28
context 'when a log file' do
29
let(:body) { File.read(fixtures.join('debug.log')) }
30
31
it 'returns the InterestingFinding' do
32
expect(finder.aggressive).to eql WPScan::Model::DebugLog.new(
33
log_url,
34
confidence: 100,
35
found_by: described_class::DIRECT_ACCESS
36
)
37
end
38
end
39
end
40
end
41
42