Path: blob/master/spec/app/finders/interesting_findings/full_path_disclosure_spec.rb
1483 views
# frozen_string_literal: true12describe WPScan::Finders::InterestingFindings::FullPathDisclosure do3subject(:finder) { described_class.new(target) }4let(:target) { WPScan::Target.new(url) }5let(:url) { 'http://ex.lo/' }6let(:fixtures) { FINDERS_FIXTURES.join('interesting_findings', 'fpd') }7let(:file_url) { target.url('wp-includes/rss-functions.php') }89describe '#aggressive' do10before do11expect(target).to receive(:sub_dir).at_least(1).and_return(false)12stub_request(:get, file_url).to_return(body: body)13end1415context 'when empty file' do16let(:body) { '' }1718its(:aggressive) { should be_nil }19end2021context 'when a log file' do22let(:body) { File.read(fixtures.join('rss_functions.php')) }2324it 'returns the InterestingFinding' do25found = finder.aggressive2627expect(found).to eql WPScan::Model::FullPathDisclosure.new(28file_url,29confidence: 100,30found_by: described_class::DIRECT_ACCESS31)32expect(found.interesting_entries).to eql %w[/blog/wp-includes/rss-functions.php]33end34end35end36end373839