Merge pull request #749 from dctabuyz/master
wp_must_use_plugins.rb fix page hash calculation & encode IDN
This commit is contained in:
@@ -35,6 +35,7 @@ begin
|
||||
require 'nokogiri'
|
||||
require 'terminal-table'
|
||||
require 'ruby-progressbar'
|
||||
require 'addressable/uri'
|
||||
# Custom libs
|
||||
require 'common/browser'
|
||||
require 'common/custom_option_parser'
|
||||
|
||||
@@ -23,9 +23,9 @@ class WpTarget < WebSite
|
||||
# @return [ Boolean ]
|
||||
def default_wp_content_dir_exists?
|
||||
response = Browser.get(@uri.merge('wp-content').to_s)
|
||||
hash = Digest::MD5.hexdigest(response.body)
|
||||
|
||||
if WpTarget.valid_response_codes.include?(response.code)
|
||||
hash = WebSite.page_hash(response)
|
||||
return true if hash != error_404_hash and hash != homepage_hash
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class WpTarget < WebSite
|
||||
response = Browser.get(must_use_url)
|
||||
|
||||
if response && WpTarget.valid_response_codes.include?(response.code)
|
||||
hash = WebSite.page_hash(response.body)
|
||||
hash = WebSite.page_hash(response)
|
||||
return true if hash != error_404_hash && hash != homepage_hash
|
||||
end
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ class WpscanOptions
|
||||
def url=(url)
|
||||
raise Exception.new('Empty URL given') if url.nil? || url == ''
|
||||
|
||||
url = Addressable::URI.parse(url).normalize.to_s unless url.ascii_only?
|
||||
|
||||
@url = URI.parse(add_http_protocol(url)).to_s
|
||||
end
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ describe 'WpscanOptions' do
|
||||
@wpscan_options.url = url
|
||||
expect(@wpscan_options.url).to be === url
|
||||
end
|
||||
|
||||
it 'should encode IDN' do
|
||||
@wpscan_options.url = 'http://пример.испытание/'
|
||||
expect(@wpscan_options.url).to be === 'http://xn--e1afmkfd.xn--80akhbyknj4f/'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#threads=' do
|
||||
|
||||
@@ -5,14 +5,14 @@ require 'spec_helper'
|
||||
describe 'wpscan main checks' do
|
||||
|
||||
it 'should check for errors on running the mainscript' do
|
||||
a = %x[ruby #{ROOT_DIR}/wpscan.rb]
|
||||
a = %x[#{RbConfig.ruby} #{ROOT_DIR}/wpscan.rb]
|
||||
expect(a).to match /No argument supplied/
|
||||
end
|
||||
|
||||
it 'should check for valid syntax' do
|
||||
result = ""
|
||||
Dir.glob("**/*.rb") do |file|
|
||||
res = %x{ruby -c #{ROOT_DIR}/#{file} 2>&1}.split("\n")
|
||||
res = %x{#{RbConfig.ruby} -c #{ROOT_DIR}/#{file} 2>&1}.split("\n")
|
||||
ok = res.select {|msg| msg =~ /Syntax OK/}
|
||||
result << ("####################\nSyntax error in #{file}:\n#{res.join("\n").strip()}\n") if ok.size != 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user