Path: blob/master/app/finders/users/author_sitemap.rb
2251 views
# frozen_string_literal: true12module WPScan3module Finders4module Users5# Since WP 5.5, /wp-sitemap-users-1.xml is generated and contains6# the usernames of accounts who made a post7class AuthorSitemap < CMSScanner::Finders::Finder8# @param [ Hash ] opts9#10# @return [ Array<User> ]11def aggressive(_opts = {})12found = []1314Browser.get(sitemap_url).html.xpath('//url/loc').each do |user_tag|15username = user_tag.text.to_s[%r{/author/([^/]+)/}, 1]1617next unless username && !username.strip.empty?1819found << Model::User.new(username,20found_by: found_by,21confidence: 100,22interesting_entries: [sitemap_url])23end2425found26end2728# @return [ String ] The URL of the sitemap29def sitemap_url30@sitemap_url ||= target.url('wp-sitemap-users-1.xml')31end32end33end34end35end363738