Class: Ronin::Address

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/ronin/address.rb

Overview

A base model which represents an Internet Address, such as:

Direct Known Subclasses

HostName, IPAddress, MACAddress

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Model

included

Class Method Details

+ (Address?) [](key)

Finds an address.

Parameters:

  • key (String, Integer)

    The address or index to search for.

Returns:

  • (Address, nil)

    The found address.

Since:

  • 1.0.0



88
89
90
91
92
93
94
# File 'lib/ronin/address.rb', line 88

def self.[](key)
  if key.kind_of?(String)
    first(:address => key)
  else
    super(key)
  end
end

+ (Object) address(repository = nil)

The Address



43
44
# File 'lib/ronin/address.rb', line 43

property :address, String, :required => true,
:unique => true

+ (Object) campaigns(repository = nil)

The campaigns targeting the address



53
# File 'lib/ronin/address.rb', line 53

has 0..n, :campaigns, :through => :targets

+ (Object) id(repository = nil)

The primary key of the Address



37
# File 'lib/ronin/address.rb', line 37

property :id, Serial

+ (Object) organization(repository = nil)

The optional organization the host belongs to



47
# File 'lib/ronin/address.rb', line 47

belongs_to :organization, :required => false

+ (Address) parse(address)

Parses the address.

Parameters:

  • address (String)

    The address to parse.

Returns:

  • (Address)

    The parsed address.

Since:

  • 1.3.0



71
72
73
# File 'lib/ronin/address.rb', line 71

def self.parse(address)
  first_or_new(:address => address)
end

+ (Object) targets(repository = nil)

The targets associated with the address



50
# File 'lib/ronin/address.rb', line 50

has 0..n, :targets

+ (Object) type(repository = nil)

The class name of the Address



40
# File 'lib/ronin/address.rb', line 40

property :type, Discriminator, :required => true

Instance Method Details

- (Object) address

The Address



43
44
# File 'lib/ronin/address.rb', line 43

property :address, String, :required => true,
:unique => true

- (Object) address=(value)

The Address



43
44
# File 'lib/ronin/address.rb', line 43

property :address, String, :required => true,
:unique => true

- (Object) campaigns

The campaigns targeting the address



53
# File 'lib/ronin/address.rb', line 53

has 0..n, :campaigns, :through => :targets

- (Object) campaigns=(new_campaigns)

The campaigns targeting the address



53
# File 'lib/ronin/address.rb', line 53

has 0..n, :campaigns, :through => :targets

- (Object) id

The primary key of the Address



37
# File 'lib/ronin/address.rb', line 37

property :id, Serial

- (Object) id=(value)

The primary key of the Address



37
# File 'lib/ronin/address.rb', line 37

property :id, Serial

- (String) inspect

Inspects the address.

Returns:

  • (String)

    The inspected address.

Since:

  • 1.0.0



120
121
122
# File 'lib/ronin/address.rb', line 120

def inspect
  "#<#{self.class}: #{self.address}>"
end

- (Object) organization

The optional organization the host belongs to



47
# File 'lib/ronin/address.rb', line 47

belongs_to :organization, :required => false

- (Object) organization=(resource)

The optional organization the host belongs to



47
# File 'lib/ronin/address.rb', line 47

belongs_to :organization, :required => false

- (Object) targets

The targets associated with the address



50
# File 'lib/ronin/address.rb', line 50

has 0..n, :targets

- (Object) targets=(new_targets)

The targets associated with the address



50
# File 'lib/ronin/address.rb', line 50

has 0..n, :targets

- (String) to_s

Converts the address into a string.

Returns:

  • (String)

    The address.

Since:

  • 1.0.0



106
107
108
# File 'lib/ronin/address.rb', line 106

def to_s
  self.address.to_s
end

- (Object) type

The class name of the Address



40
# File 'lib/ronin/address.rb', line 40

property :type, Discriminator, :required => true

- (Object) type=(value)

The class name of the Address



40
# File 'lib/ronin/address.rb', line 40

property :type, Discriminator, :required => true