Parent

Files

WpItem

Attributes

path[RW]
url[RW]
wp_content_dir[RW]

Public Instance Methods

<=>(item) click to toggle source
# File lib/wpscan/wp_item.rb, line 64
def <=>(item)
  item.name <=> @name
end
==(item) click to toggle source
# File lib/wpscan/wp_item.rb, line 60
def ==(item)
  item.name == @name
end
changelog_url() click to toggle source
# File lib/wpscan/wp_item.rb, line 80
def changelog_url
  get_url_without_filename.merge("changelog.txt")
end
directory_listing?() click to toggle source

Is directory listing enabled?

# File lib/wpscan/wp_item.rb, line 46
def directory_listing?
  # Need to remove to file part from the url
  Browser.instance.get(location_uri_from_file_url(get_url.to_s)).body[%{<title>Index of}] ? true : false
end
extract_name_from_url(url) click to toggle source
# File lib/wpscan/wp_item.rb, line 51
def extract_name_from_url(url)
  url.to_s[%{^(https?://.*/([^/]+)/)}, 2]
end
get_url() click to toggle source
# File lib/wpscan/wp_item.rb, line 23
def get_url
  URI.parse("#{@url.to_s}#@wp_content_dir/#@path")
end
get_url_without_filename() click to toggle source
# File lib/wpscan/wp_item.rb, line 27
def get_url_without_filename
  matches = @path.match(%{^(.*/).*$})
  if matches == nil or matches.length < 2
    dirname = @path
  else
    dirname = matches[1]
  end
  URI.parse("#{@url.to_s}#@wp_content_dir/#{dirname}")
end
has_changelog?() click to toggle source
# File lib/wpscan/wp_item.rb, line 92
def has_changelog?
  unless @changelog
    status = Browser.instance.get(changelog_url).code
    @changelog = status == 200 ? true : false
  end
  @changelog
end
has_readme?() click to toggle source
# File lib/wpscan/wp_item.rb, line 84
def has_readme?
  unless @readme
    status = Browser.instance.get(readme_url).code
    @readme = status == 200 ? true : false
  end
  @readme
end
location_uri_from_file_url(location_url) click to toggle source
# File lib/wpscan/wp_item.rb, line 68
def location_uri_from_file_url(location_url)
  valid_location_url = location_url[%{^(https?://.*/)[^.]+\.[^/]+$}, 1]
  unless valid_location_url
    valid_location_url = add_trailing_slash(location_url)
  end
  URI.parse(valid_location_url)
end
readme_url() click to toggle source
# File lib/wpscan/wp_item.rb, line 76
def readme_url
  get_url_without_filename.merge("readme.txt")
end
to_s() click to toggle source
# File lib/wpscan/wp_item.rb, line 55
def to_s
  item_version = version
  "#@name#{' v' + item_version.strip if item_version}"
end
version() click to toggle source
# File lib/wpscan/wp_item.rb, line 37
def version
  unless @version
    response = Browser.instance.get(get_url.merge("readme.txt").to_s)
    @version = response.body[%{stable tag: #{WpVersion.version_pattern}}, 1]
  end
  @version
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.