From ff98a7b23b7fba242d4e5f3150a9c41601cab1e5 Mon Sep 17 00:00:00 2001 From: erwanlr Date: Wed, 1 May 2019 19:50:43 +0100 Subject: [PATCH] Fixes #1341 --- .../wordpress/custom_directories/with_port.html | 16 ++++++++++++++++ .../platform/wordpress/custom_directories.rb | 10 ++++++++++ wpscan.gemspec | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/target/platform/wordpress/custom_directories/with_port.html diff --git a/spec/fixtures/target/platform/wordpress/custom_directories/with_port.html b/spec/fixtures/target/platform/wordpress/custom_directories/with_port.html new file mode 100644 index 00000000..e7c59418 --- /dev/null +++ b/spec/fixtures/target/platform/wordpress/custom_directories/with_port.html @@ -0,0 +1,16 @@ + + + + + WordPress 4.0 | Just another WordPress site + + + + + + + + + + + diff --git a/spec/shared_examples/target/platform/wordpress/custom_directories.rb b/spec/shared_examples/target/platform/wordpress/custom_directories.rb index 1f0a8174..20a5d1c7 100644 --- a/spec/shared_examples/target/platform/wordpress/custom_directories.rb +++ b/spec/shared_examples/target/platform/wordpress/custom_directories.rb @@ -31,6 +31,16 @@ shared_examples 'WordPress::CustomDirectories' do end end + context 'when the target URL is invalid according to PublicSuffix and contains a port' do + let(:url) { 'http://wp-lab:82/aa' } + + it 'returns wp-content when matches' do + stub_request(:get, target.url).to_return(body: File.read(fixtures.join('with_port.html'))) + + expect(target.content_dir).to eql 'wp-content' + end + end + context 'when not found via the homepage' do before { stub_request(:get, target.url).to_return(body: '') } diff --git a/wpscan.gemspec b/wpscan.gemspec index c9d9bf01..775b58c4 100644 --- a/wpscan.gemspec +++ b/wpscan.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.executables = ['wpscan'] s.require_paths = ['lib'] - s.add_dependency 'cms_scanner', '~> 0.5.0' + s.add_dependency 'cms_scanner', '~> 0.5.1' s.add_development_dependency 'bundler', '>= 1.6' s.add_development_dependency 'coveralls', '~> 0.8.0'