Only output wordpress url if this item is hosted on wordpress

This commit is contained in:
Christian Mehlmauer
2013-01-19 21:17:06 +01:00
parent a8664a0fec
commit 47b4f47264
2 changed files with 18 additions and 4 deletions

View File

@@ -53,6 +53,20 @@ class WpItem < Vulnerable
end end
end end
# returns true if this theme or plugin is hosted on wordpress.org
def wp_org_item?
case @type
when "themes"
file = "#{DATA_DIR}/themes_full.txt"
when "plugins"
file = "#{DATA_DIR}/plugins_full.txt"
else
raise("Unknown type #@type")
end
f = File.readlines(file).grep(/^#{Regexp.escape(@name)}$/i)
f.empty? ? false : true
end
def get_sub_folder def get_sub_folder
case @type case @type
when "themes" when "themes"

View File

@@ -138,7 +138,7 @@ begin
puts puts
puts " | Name: #{wp_theme}" #this will also output the version number if detected puts " | Name: #{wp_theme}" #this will also output the version number if detected
puts " | Location: #{wp_theme.get_url_without_filename}" puts " | Location: #{wp_theme.get_url_without_filename}"
puts " | WordPress: #{wp_theme.wp_org_url}" puts " | WordPress: #{wp_theme.wp_org_url}" if wp_theme.wp_org_item?
puts " | Directory listing enabled: Yes" if wp_theme.directory_listing? puts " | Directory listing enabled: Yes" if wp_theme.directory_listing?
puts " | Readme: #{wp_theme.readme_url}" if wp_theme.has_readme? puts " | Readme: #{wp_theme.readme_url}" if wp_theme.has_readme?
puts " | Changelog: #{wp_theme.changelog_url}" if wp_theme.has_changelog? puts " | Changelog: #{wp_theme.changelog_url}" if wp_theme.has_changelog?
@@ -219,7 +219,7 @@ begin
puts puts
puts " | Name: #{plugin.name}" puts " | Name: #{plugin.name}"
puts " | Location: #{plugin.get_full_url}" puts " | Location: #{plugin.get_full_url}"
puts " | WordPress: #{plugin.wp_org_url}" puts " | WordPress: #{plugin.wp_org_url}" if plugin.wp_org_item?
output_vulnerabilities(plugin.vulnerabilities) output_vulnerabilities(plugin.vulnerabilities)
end end
@@ -256,7 +256,7 @@ begin
puts puts
puts " | Name: #{plugin}" #this will also output the version number if detected puts " | Name: #{plugin}" #this will also output the version number if detected
puts " | Location: #{plugin.get_url_without_filename}" puts " | Location: #{plugin.get_url_without_filename}"
puts " | WordPress: #{plugin.wp_org_url}" puts " | WordPress: #{plugin.wp_org_url}" if plugin.wp_org_item?
puts " | Directory listing enabled: Yes" if plugin.directory_listing? puts " | Directory listing enabled: Yes" if plugin.directory_listing?
puts " | Readme: #{plugin.readme_url}" if plugin.has_readme? puts " | Readme: #{plugin.readme_url}" if plugin.has_readme?
puts " | Changelog: #{plugin.changelog_url}" if plugin.has_changelog? puts " | Changelog: #{plugin.changelog_url}" if plugin.has_changelog?
@@ -300,7 +300,7 @@ begin
puts puts
puts " | Name: #{theme}" #this will also output the version number if detected puts " | Name: #{theme}" #this will also output the version number if detected
puts " | Location: #{theme.get_url_without_filename}" puts " | Location: #{theme.get_url_without_filename}"
puts " | WordPress: #{theme.wp_org_url}" puts " | WordPress: #{theme.wp_org_url}" if theme.wp_org_item?
puts " | Directory listing enabled: Yes" if theme.directory_listing? puts " | Directory listing enabled: Yes" if theme.directory_listing?
puts " | Readme: #{theme.readme_url}" if theme.has_readme? puts " | Readme: #{theme.readme_url}" if theme.has_readme?
puts " | Changelog: #{theme.changelog_url}" if theme.has_changelog? puts " | Changelog: #{theme.changelog_url}" if theme.has_changelog?