module WpItem::Infos

@uri is used instead of uri to avoid the presence of the :path into it

Public Instance Methods

changelog_url() click to toggle source

@return [ String ] The url to the changelog file

# File lib/common/models/wp_item/infos.rb, line 36
def changelog_url
  @uri.merge('changelog.txt').to_s
end
error_log_url() click to toggle source

@return [ String ] The url to the error_log file

# File lib/common/models/wp_item/infos.rb, line 57
def error_log_url
  @uri.merge('error_log').to_s
end
has_changelog?() click to toggle source

@return [ Boolean ]

# File lib/common/models/wp_item/infos.rb, line 22
def has_changelog?
  url_is_200?(changelog_url)
end
has_directory_listing?() click to toggle source

@return [ Boolean ]

# File lib/common/models/wp_item/infos.rb, line 41
def has_directory_listing?
  Browser.get(@uri.to_s).body[%r{<title>Index of}] ? true : false
end
has_error_log?() click to toggle source

Discover any error_log files created by WordPress These are created by the WordPress error_log() function They are normally found in the /plugins/ directory, however can also be found in their specific plugin dir. www.exploit-db.com/ghdb/3714/

@return [ Boolean ]

# File lib/common/models/wp_item/infos.rb, line 52
def has_error_log?
  WebSite.has_log?(error_log_url, %r{PHP Fatal error})
end
has_readme?() click to toggle source

@return [ Boolean ]

# File lib/common/models/wp_item/infos.rb, line 8
def has_readme?
  !readme_url.nil?
end
readme_url() click to toggle source

@return [ String,nil ] The url to the readme file, nil if not found

# File lib/common/models/wp_item/infos.rb, line 13
def readme_url
  %w{readme.txt README.txt}.each do |readme|
    url = @uri.merge(readme).to_s
    return url if url_is_200?(url)
  end
  nil
end
url_is_200?(url) click to toggle source

Checks if the url status code is 200

@param [ String ] url

@return [ Boolean ] True if the url status is 200

# File lib/common/models/wp_item/infos.rb, line 31
def url_is_200?(url)
  Browser.get(url).code == 200
end