Class: Ronin::DB::OpenPort

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Model, Model::LastScannedAt
Defined in:
lib/ronin/db/open_port.rb

Overview

Represents a open port at a specified IP address.

Instance Attribute Summary collapse

Attributes included from Model::LastScannedAt

#last_scanned_at

Instance Method Summary collapse

Methods included from Model::LastScannedAt

included

Methods included from Model

included

Instance Attribute Details

#created_atTime (readonly)

Define the created_at timestamp

Returns:

  • (Time)


77
# File 'lib/ronin/db/open_port.rb', line 77

attribute :created_at, :datetime

#credentialsArray<Credential>

The credentials that will work with this open port.

Returns:



89
# File 'lib/ronin/db/open_port.rb', line 89

has_many :credentials, through: :service_credentials

#idInteger

The primary key of the open port.

Returns:

  • (Integer)


40
# File 'lib/ronin/db/open_port.rb', line 40

attribute :id, :integer

#ip_addressIPAddress

The IP Address that was scanned.

Returns:



46
47
# File 'lib/ronin/db/open_port.rb', line 46

belongs_to :ip_address, required: true,
class_name: 'IPAddress'

#portPort

The port.

Returns:



53
# File 'lib/ronin/db/open_port.rb', line 53

belongs_to :port, required: true

#serviceService?

The service detected on the port

Returns:



59
# File 'lib/ronin/db/open_port.rb', line 59

belongs_to :service, optional: true

#service_credentialsArray<ServiceCredential>

Credentials used by the service running on the port

Returns:



83
# File 'lib/ronin/db/open_port.rb', line 83

has_many :service_credentials, dependent: :destroy

#softwareSoftware

The software running on the open port

Returns:



65
# File 'lib/ronin/db/open_port.rb', line 65

belongs_to :software, optional: true

#sslBoolean

Specifies whether the service requires SSL.

Returns:

  • (Boolean)


71
# File 'lib/ronin/db/open_port.rb', line 71

attribute :ssl, :boolean

Instance Method Details

#addressString

The IP Address of the open port.

Returns:

  • (String)

    The IP Address.



99
100
101
# File 'lib/ronin/db/open_port.rb', line 99

def address
  self.ip_address.address
end

#numberInteger

The port number.

Returns:

  • (Integer)

    The port number.



111
112
113
# File 'lib/ronin/db/open_port.rb', line 111

def number
  self.port.number
end

#to_iInteger

Converts the open port to an integer.

Returns:

  • (Integer)

    The port number.



123
124
125
# File 'lib/ronin/db/open_port.rb', line 123

def to_i
  self.port.to_i
end

#to_sString

Converts the open port to a string.

Returns:

  • (String)

    The information of the open port.



135
136
137
138
139
# File 'lib/ronin/db/open_port.rb', line 135

def to_s
  if self.service then "#{self.port} (#{self.service})"
  else                 "#{self.port}"
  end
end