Module: WpItem::Infos

Included in:
WpItem
Defined in:
lib/common/models/wp_item/infos.rb

Instance Method Summary collapse

Instance Method Details

#changelog_urlString

Returns The url to the changelog file

Returns:

  • (String)

    The url to the changelog file


39
40
41
# File 'lib/common/models/wp_item/infos.rb', line 39

def changelog_url
  @uri.merge('changelog.txt').to_s
end

#error_log_urlString

Returns The url to the error_log file

Returns:

  • (String)

    The url to the error_log file


60
61
62
# File 'lib/common/models/wp_item/infos.rb', line 60

def error_log_url
  @uri.merge('error_log').to_s
end

#has_changelog?Boolean

Returns:

  • (Boolean)

25
26
27
# File 'lib/common/models/wp_item/infos.rb', line 25

def has_changelog?
  url_is_200?(changelog_url)
end

#has_directory_listing?Boolean

Returns:

  • (Boolean)

44
45
46
# File 'lib/common/models/wp_item/infos.rb', line 44

def has_directory_listing?
  directory_listing_enabled?(@uri)
end

#has_error_log?Boolean

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/

Returns:

  • (Boolean)

55
56
57
# File 'lib/common/models/wp_item/infos.rb', line 55

def has_error_log?
  WebSite.has_log?(error_log_url, %r{PHP Fatal error}i)
end

#has_readme?Boolean

Returns:

  • (Boolean)

9
10
11
# File 'lib/common/models/wp_item/infos.rb', line 9

def has_readme?
  !readme_url.nil?
end

#readme_urlString?

Returns The url to the readme file, nil if not found

Returns:

  • (String, nil)

    The url to the readme file, nil if not found


14
15
16
17
18
19
20
21
22
# File 'lib/common/models/wp_item/infos.rb', line 14

def readme_url
  # See https://github.com/wpscanteam/wpscan/pull/737#issuecomment-66375445
  # for any question about the order
  %w{readme.txt README.txt Readme.txt ReadMe.txt 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) ⇒ Boolean

Checks if the url status code is 200

Parameters:

  • url (String)

Returns:

  • (Boolean)

    True if the url status is 200


34
35
36
# File 'lib/common/models/wp_item/infos.rb', line 34

def url_is_200?(url)
  Browser.get(url).code == 200
end