Fix wpstools check-vuln-ref-urls
This commit is contained in:
@@ -64,14 +64,6 @@ end
|
|||||||
|
|
||||||
require_files_from_directory(COMMON_LIB_DIR, '**/*.rb')
|
require_files_from_directory(COMMON_LIB_DIR, '**/*.rb')
|
||||||
|
|
||||||
# Hook to check if the target if down during the scan
|
|
||||||
# The target is considered down after 10 requests with status = 0
|
|
||||||
down = 0
|
|
||||||
Typhoeus.on_complete do |response|
|
|
||||||
down += 1 if response.code == 0
|
|
||||||
fail 'The target seems to be down' if down >= 10
|
|
||||||
end
|
|
||||||
|
|
||||||
# Add protocol
|
# Add protocol
|
||||||
def add_http_protocol(url)
|
def add_http_protocol(url)
|
||||||
url =~ /^https?:/ ? url : "http://#{url}"
|
url =~ /^https?:/ ? url : "http://#{url}"
|
||||||
|
|||||||
@@ -108,3 +108,11 @@ def help
|
|||||||
puts '--verbose | -v Verbose output.'
|
puts '--verbose | -v Verbose output.'
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Hook to check if the target if down during the scan
|
||||||
|
# The target is considered down after 10 requests with status = 0
|
||||||
|
down = 0
|
||||||
|
Typhoeus.on_complete do |response|
|
||||||
|
down += 1 if response.code == 0
|
||||||
|
fail 'The target seems to be down' if down >= 10
|
||||||
|
end
|
||||||
|
|||||||
@@ -29,11 +29,18 @@ class CheckerPlugin < Plugin
|
|||||||
puts '[+] Checking vulnerabilities reference urls'
|
puts '[+] Checking vulnerabilities reference urls'
|
||||||
|
|
||||||
vuln_ref_files.each do |vuln_ref_file|
|
vuln_ref_files.each do |vuln_ref_file|
|
||||||
xml = xml(vuln_ref_file)
|
json = json(vuln_ref_file)
|
||||||
|
|
||||||
urls = []
|
urls = []
|
||||||
xml.xpath('//references/url').each { |node| urls << node.text }
|
json.each do |asset|
|
||||||
|
asset[asset.keys.inject]['vulnerabilities'].each do |url|
|
||||||
|
unless url['url'].nil?
|
||||||
|
url['url'].split(',').each do |url|
|
||||||
|
urls << url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
urls.uniq!
|
urls.uniq!
|
||||||
|
|
||||||
puts "[!] No URLs found in #{vuln_ref_file}!" if urls.empty?
|
puts "[!] No URLs found in #{vuln_ref_file}!" if urls.empty?
|
||||||
|
|||||||
Reference in New Issue
Block a user