Adds YT references in output
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
module WPScan
|
||||
# References module (which should be included along with the CMSScanner::References)
|
||||
# to allow the use of the wpvulndb reference
|
||||
# to allow the use of the wpvulndb and youtube references.
|
||||
# Notes: The youtube references are not handled the same way all the others, especialy in the JSON output
|
||||
# as we output the full URL and not just the ID. Hence the override of the references= method
|
||||
module References
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
@@ -10,12 +12,27 @@ module WPScan
|
||||
module ClassMethods
|
||||
# @return [ Array<Symbol> ]
|
||||
def references_keys
|
||||
@references_keys ||= super << :wpvulndb
|
||||
@references_keys ||= super << :wpvulndb << :youtube
|
||||
end
|
||||
end
|
||||
|
||||
# @param [ Hash ] refs
|
||||
def references=(refs)
|
||||
@references = {}
|
||||
|
||||
self.class.references_keys.each do |key|
|
||||
next unless refs.key?(key)
|
||||
|
||||
@references[key] = if key == :youtube
|
||||
[*refs[:youtube]].map { |id| youtube_url(id) }
|
||||
else
|
||||
[*refs[key]].map(&:to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def references_urls
|
||||
wpvulndb_urls + super
|
||||
wpvulndb_urls + super + youtube_urls
|
||||
end
|
||||
|
||||
def wpvulndb_ids
|
||||
@@ -29,5 +46,13 @@ module WPScan
|
||||
def wpvulndb_url(id)
|
||||
"https://wpvulndb.com/vulnerabilities/#{id}"
|
||||
end
|
||||
|
||||
def youtube_urls
|
||||
references[:youtube] || []
|
||||
end
|
||||
|
||||
def youtube_url(id)
|
||||
"https://www.youtube.com/watch?v=#{id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user