Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/app/finders/users/rss_generator.rb
485 views
1
# frozen_string_literal: true
2
3
module WPScan
4
module Finders
5
module Users
6
# Users disclosed from the dc:creator field in the RSS
7
# The names disclosed are display names, however depending on the configuration of the blog,
8
# they can be the same than usernames
9
class RSSGenerator < Finders::WpVersion::RSSGenerator
10
def process_urls(urls, _opts = {})
11
found = []
12
13
urls.each do |url|
14
res = Browser.get_and_follow_location(url)
15
16
next unless res.code == 200 && res.body =~ /<dc:creator>/i
17
18
potential_usernames = []
19
20
begin
21
res.xml.xpath('//item/dc:creator').each do |node|
22
username = node.text.to_s
23
24
# Ignoring potential username longer than 60 characters and containing accents
25
# as they are considered invalid. See https://github.com/wpscanteam/wpscan/issues/1215
26
next if username.strip.empty? || username.length > 60 || username =~ /[^\x00-\x7F]/
27
28
potential_usernames << username
29
end
30
rescue Nokogiri::XML::XPath::SyntaxError
31
next
32
end
33
34
potential_usernames.uniq.each do |username|
35
found << Model::User.new(username, found_by: found_by, confidence: 50)
36
end
37
38
break
39
end
40
41
found
42
end
43
end
44
end
45
end
46
end
47
48