Fixes #1638
This commit is contained in:
@@ -40,7 +40,6 @@ module WPScan
|
|||||||
# @return [ Hash ]
|
# @return [ Hash ]
|
||||||
def potential_urls(opts = {})
|
def potential_urls(opts = {})
|
||||||
urls = {}
|
urls = {}
|
||||||
domain_name = (PublicSuffix.domain(target.uri.host) || target.uri.host)[/(^[\w|-]+)/, 1]
|
|
||||||
|
|
||||||
File.open(opts[:list]).each_with_index do |path, index|
|
File.open(opts[:list]).each_with_index do |path, index|
|
||||||
path.gsub!('{domain_name}', domain_name)
|
path.gsub!('{domain_name}', domain_name)
|
||||||
@@ -51,6 +50,14 @@ module WPScan
|
|||||||
urls
|
urls
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def domain_name
|
||||||
|
@domain_name ||= if Resolv::AddressRegex.match?(target.uri.host)
|
||||||
|
target.uri.host
|
||||||
|
else
|
||||||
|
(PublicSuffix.domain(target.uri.host) || target.uri.host)[/(^[\w|-]+)/, 1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create_progress_bar(opts = {})
|
def create_progress_bar(opts = {})
|
||||||
super(opts.merge(title: ' Checking DB Exports -'))
|
super(opts.merge(title: ' Checking DB Exports -'))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ require 'uri'
|
|||||||
require 'time'
|
require 'time'
|
||||||
require 'readline'
|
require 'readline'
|
||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
|
require 'resolv'
|
||||||
# Monkey Patches/Fixes/Override
|
# Monkey Patches/Fixes/Override
|
||||||
require 'wpscan/typhoeus/response' # Adds a from_vuln_api? method
|
require 'wpscan/typhoeus/response' # Adds a from_vuln_api? method
|
||||||
# Custom Libs
|
# Custom Libs
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ describe WPScan::Finders::DbExports::KnownLocations do
|
|||||||
expect(finder.potential_urls(opts).keys).to include "#{url}/dc-2.sql"
|
expect(finder.potential_urls(opts).keys).to include "#{url}/dc-2.sql"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when an IP address' do
|
||||||
|
let(:url) { 'http://192.168.1.12' }
|
||||||
|
|
||||||
|
it 'replaces {domain_name} by the IP address' do
|
||||||
|
expect(finder.potential_urls(opts).keys).to include "#{url}/192.168.1.12.sql"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#aggressive' do
|
describe '#aggressive' do
|
||||||
|
|||||||
Reference in New Issue
Block a user