Module: WPScan::Model::WpItem::WordpressOrgData

Included in:
WPScan::Model::WpItem
Defined in:
app/models/wp_item/wordpress_org_data.rb

Overview

Fetches and exposes the public wordpress.org info API response for a plugin or theme. The HTTP call is performed at most once per item.

Constant Summary collapse

WORDPRESS_ORG_API_TIMEOUT =

Timeout (in seconds) for the wordpress.org API lookup. Kept low so a slow or unreachable wordpress.org does not noticeably stall the scan.

5

Instance Method Summary collapse

Instance Method Details

#active_installsInteger?

Number of active installs as reported by the wordpress.org API. See codex.wordpress.org/WordPress.org_API

Returns:

  • (Integer, nil)


31
32
33
# File 'app/models/wp_item/wordpress_org_data.rb', line 31

def active_installs
  wordpress_org_data['active_installs']
end

#wordpress_org_api_urlString?

Returns The wordpress.org API URL returning info for this item. Subclasses override this; nil disables the lookup.

Returns:

  • (String, nil)

    The wordpress.org API URL returning info for this item. Subclasses override this; nil disables the lookup.



15
16
17
# File 'app/models/wp_item/wordpress_org_data.rb', line 15

def wordpress_org_api_url
  nil
end

#wordpress_org_dataHash

Returns Empty hash if the item is not on wordpress.org or the lookup fails.

Returns:

  • (Hash)

    Empty hash if the item is not on wordpress.org or the lookup fails.



21
22
23
24
25
# File 'app/models/wp_item/wordpress_org_data.rb', line 21

def wordpress_org_data
  return @wordpress_org_data if defined?(@wordpress_org_data)

  @wordpress_org_data = fetch_wordpress_org_data
end