Class List Method List File List

# Module: WpItem::Infos

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

## Instance Method Summary (collapse)

- - (String) changelog_url

  The url to the changelog file.

- - (String) error_log_url

  The url to the error_log file.

- - (Boolean) has_changelog?
- - (Boolean) has_directory_listing?
- - (Boolean) has_error_log?

  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.

- - (Boolean) has_readme?
- - (String?) readme_url

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

- - (Boolean) url_is_200?(url)

  Checks if the url status code is 200.

## Instance Method Details

### - (`String`) changelog_url

The url to the changelog file

Returns:

- (`String`) —

  The url to the changelog file

    37
    38
    39
    # File 'lib/common/models/wp_item/infos.rb', line 37

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

### - (`String`) error_log_url

The url to the error_log file

Returns:

- (`String`) —

  The url to the error_log file

    58
    59
    60
    # File 'lib/common/models/wp_item/infos.rb', line 58

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

### - (`Boolean`) has_changelog?

Returns:

- (`Boolean`)

    23
    24
    25
    # File 'lib/common/models/wp_item/infos.rb', line 23

    def has_changelog?
      url_is_200?(changelog_url)
    end

### - (`Boolean`) has_directory_listing?

Returns:

- (`Boolean`)

    42
    43
    44
    # File 'lib/common/models/wp_item/infos.rb', line 42

    def has_directory_listing?
      Browser.get(@uri.to_s).body[%r{<title>Index of}] ? true : false
    end

### - (`Boolean`) has_error_log?

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`)

    53
    54
    55
    # File 'lib/common/models/wp_item/infos.rb', line 53

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

### - (`Boolean`) has_readme?

Returns:

- (`Boolean`)

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

    def has_readme?
      !readme_url.nil?
    end

### - (`String`?) readme_url

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
    # File 'lib/common/models/wp_item/infos.rb', line 14

    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

### - (`Boolean`) url_is_200?(url)

Checks if the url status code is 200

Parameters:

- url (`String`)

Returns:

- (`Boolean`) —

  True if the url status is 200

    32
    33
    34
    # File 'lib/common/models/wp_item/infos.rb', line 32

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