Class: WpItem

Inherits:
Object
  • Object
show all
Extended by:
Findable
Includes:
Existable, Infos, Output, Versionable, Vulnerable
Defined in:
lib/common/models/wp_item.rb,
lib/common/models/wp_item/infos.rb,
lib/common/models/wp_item/output.rb,
lib/common/models/wp_item/findable.rb,
lib/common/models/wp_item/existable.rb,
lib/common/models/wp_item/vulnerable.rb,
lib/common/models/wp_item/versionable.rb

Direct Known Subclasses

WpPlugin, WpTheme, WpTimthumb, WpUser, WpVersion

Defined Under Namespace

Modules: Existable, Findable, Infos, Output, Versionable, Vulnerable

Instance Attribute Summary collapse

Attributes included from Vulnerable

#identifier, #vulns_file

Instance Method Summary collapse

Methods included from Output

#output

Methods included from Infos

#changelog_url, #error_log_url, #has_changelog?, #has_directory_listing?, #has_error_log?, #has_readme?, #readme_url, #url_is_200?

Methods included from Existable

#exists?

Methods included from Vulnerable

#vulnerabilities, #vulnerable?, #vulnerable_to?

Methods included from Versionable

#to_s, #version

Constructor Details

#initialize(target_base_uri, options = {}) ⇒ WpItem

Parameters:

  • target_base_uri (URI)
  • options (Hash) (defaults to: {})

    See allowed_option


32
33
34
35
36
37
38
39
# File 'lib/common/models/wp_item.rb', line 32

def initialize(target_base_uri, options = {})

  options[:wp_content_dir] ||= 'wp-content'
  options[:wp_plugins_dir] ||= options[:wp_content_dir] + '/plugins'

  set_options(options)
  forge_uri(target_base_uri)
end

Instance Attribute Details

#found_fromObject

Returns the value of attribute found_from


4
5
6
# File 'lib/common/models/wp_item/findable.rb', line 4

def found_from
  @found_from
end

#nameObject

Returns the value of attribute name


20
21
22
# File 'lib/common/models/wp_item.rb', line 20

def name
  @name
end

#pathObject

Returns the value of attribute path


19
20
21
# File 'lib/common/models/wp_item.rb', line 19

def path
  @path
end

#version=(value) ⇒ Object (writeonly)

Sets the attribute version

Parameters:

  • value

    the value to set the attribute version to.


4
5
6
# File 'lib/common/models/wp_item/versionable.rb', line 4

def version=(value)
  @version = value
end

#wp_content_dirObject

Returns the value of attribute wp_content_dir


20
21
22
# File 'lib/common/models/wp_item.rb', line 20

def wp_content_dir
  @wp_content_dir
end

#wp_plugins_dirObject

Returns the value of attribute wp_plugins_dir


20
21
22
# File 'lib/common/models/wp_item.rb', line 20

def wp_plugins_dir
  @wp_plugins_dir
end

Instance Method Details

#<=>(other) ⇒ Object

Parameters:


89
90
91
# File 'lib/common/models/wp_item.rb', line 89

def <=>(other)
  name <=> other.name
end

#==(other) ⇒ Object

Parameters:


94
95
96
# File 'lib/common/models/wp_item.rb', line 94

def ==(other)
  name === other.name
end

#===(other) ⇒ Object

Parameters:


99
100
101
# File 'lib/common/models/wp_item.rb', line 99

def ===(other)
  self == other && version === other.version
end

#allowed_optionsArray

Make it private ?

Returns:


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

def allowed_options
  [:name, :wp_content_dir, :wp_plugins_dir, :path, :version, :vulns_file]
end

#forge_uri(target_base_uri) ⇒ void

This method returns an undefined value.

Parameters:

  • target_base_uri (URI)

62
63
64
# File 'lib/common/models/wp_item.rb', line 62

def forge_uri(target_base_uri)
  @uri = target_base_uri
end

#uriURI

Returns The uri to the WpItem, with the path if present

Returns:

  • (URI)

    The uri to the WpItem, with the path if present


67
68
69
# File 'lib/common/models/wp_item.rb', line 67

def uri
  path ? @uri.merge(path) : @uri
end

#urlString

Returns The url to the WpItem

Returns:

  • (String)

    The url to the WpItem


72
# File 'lib/common/models/wp_item.rb', line 72

def url; uri.to_s end