detect readme.txt and changelog.txt
This commit is contained in:
@@ -25,8 +25,13 @@ module WpItem
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_url_without_filename
|
def get_url_without_filename
|
||||||
uri = get_url
|
matches = @path.match(%r{^(.*/).*$})
|
||||||
URI.parse("#{uri.scheme}://#{uri.host}#{File.dirname(uri.path)}/")
|
if matches == nil or matches.length < 2
|
||||||
|
dirname = @path
|
||||||
|
else
|
||||||
|
dirname = matches[1]
|
||||||
|
end
|
||||||
|
URI.parse("#{@url.to_s}#@wp_content_dir/#{dirname}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def version
|
def version
|
||||||
@@ -68,4 +73,28 @@ module WpItem
|
|||||||
URI.parse(valid_location_url)
|
URI.parse(valid_location_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def readme_url
|
||||||
|
get_url_without_filename.merge("readme.txt")
|
||||||
|
end
|
||||||
|
|
||||||
|
def changelog_url
|
||||||
|
get_url_without_filename.merge("changelog.txt")
|
||||||
|
end
|
||||||
|
|
||||||
|
def has_readme?
|
||||||
|
unless @readme
|
||||||
|
status = Browser.instance.get(readme_url).code
|
||||||
|
@readme = status == 200 ? true : false
|
||||||
|
end
|
||||||
|
@readme
|
||||||
|
end
|
||||||
|
|
||||||
|
def has_changelog?
|
||||||
|
unless @changelog
|
||||||
|
status = Browser.instance.get(changelog_url).code
|
||||||
|
@changelog = status == 200 ? true : false
|
||||||
|
end
|
||||||
|
@changelog
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class WpDetector
|
|||||||
items << {
|
items << {
|
||||||
:url => url,
|
:url => url,
|
||||||
:name => item,
|
:name => item,
|
||||||
:path => "#{type}/#{item}",
|
:path => "#{type}/#{item}/",
|
||||||
:wp_content_dir => wp_content_dir
|
:wp_content_dir => wp_content_dir
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -197,6 +197,8 @@ begin
|
|||||||
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 " | Directory listing enabled? #{plugin.directory_listing? ? "Yes." : "No."}"
|
puts " | Directory listing enabled? #{plugin.directory_listing? ? "Yes." : "No."}"
|
||||||
|
puts " | Readme: #{plugin.readme_url}" if plugin.has_readme?
|
||||||
|
puts " | Changelog: #{plugin.changelog_url}" if plugin.has_changelog?
|
||||||
|
|
||||||
plugin.vulnerabilities.each do |vulnerability|
|
plugin.vulnerabilities.each do |vulnerability|
|
||||||
#vulnerability['vulnerability'][0]['uri'] == nil ? "" : uri = vulnerability['vulnerability'][0]['uri'] # uri
|
#vulnerability['vulnerability'][0]['uri'] == nil ? "" : uri = vulnerability['vulnerability'][0]['uri'] # uri
|
||||||
@@ -249,6 +251,8 @@ begin
|
|||||||
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 " | Directory listing enabled? #{theme.directory_listing? ? "Yes." : "No."}"
|
puts " | Directory listing enabled? #{theme.directory_listing? ? "Yes." : "No."}"
|
||||||
|
puts " | Readme: #{theme.readme_url}" if theme.has_readme?
|
||||||
|
puts " | Changelog: #{theme.changelog_url}" if theme.has_changelog?
|
||||||
|
|
||||||
theme.vulnerabilities.each do |vulnerability|
|
theme.vulnerabilities.each do |vulnerability|
|
||||||
puts " |"
|
puts " |"
|
||||||
|
|||||||
Reference in New Issue
Block a user