Path: blob/master/app/finders/wp_version/rss_generator.rb
485 views
# frozen_string_literal: true12module WPScan3module Finders4module WpVersion5# RSS Generator Version Finder6class RSSGenerator < CMSScanner::Finders::Finder7include Finder::WpVersion::SmartURLChecker89def process_urls(urls, _opts = {})10found = Findings.new1112urls.each do |url|13res = Browser.get_and_follow_location(url)1415res.html.xpath('//comment()[contains(., "wordpress")] | //generator').each do |node|16node_text = node.text.to_s.strip1718next unless node_text =~ %r{\Ahttps?://wordpress\.(?:[a-z]+)/\?v=(.*)\z}i ||19node_text =~ %r{\Agenerator="wordpress/([^"]+)"\z}i2021found << create_version(22Regexp.last_match[1],23found_by: found_by,24entries: ["#{res.effective_url}, #{node.to_s.strip}"]25)26end27end2829found30end3132def passive_urls_xpath33'//link[@rel="alternate" and @type="application/rss+xml"]/@href'34end3536def aggressive_urls(_opts = {})37%w[feed/ comments/feed/ feed/rss/ feed/rss2/].reduce([]) do |a, uri|38a << target.url(uri)39end40end41end42end43end44end454647