Class: Ronin::DB::OpenPort
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ronin::DB::OpenPort
- 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
-
#advisories ⇒ Array<Advisory>
The advisories that the open port is vulnerable to.
-
#cert ⇒ Cert?
The SSL/TLS certificate used by the open port.
-
#created_at ⇒ Time
readonly
Define the created_at timestamp.
-
#credentials ⇒ Array<Credential>
The credentials that will work with this open port.
-
#id ⇒ Integer
The primary key of the open port.
-
#ip_address ⇒ IPAddress
The IP Address that was scanned.
-
#notes ⇒ Array<Note>
The associated notes.
-
#port ⇒ Port
The port.
-
#service ⇒ Service?
The service detected on the port.
-
#service_credentials ⇒ Array<ServiceCredential>
Credentials used by the service running on the port.
-
#software ⇒ Software
The software running on the open port.
-
#ssl ⇒ Boolean
Specifies whether the service requires SSL.
-
#vulnerabilities ⇒ Array<Vulnerability>
The vulnerabilities which reference the open port.
Attributes included from Model::LastScannedAt
Class Method Summary collapse
-
.with_ip_address(address) ⇒ Array<OpenPort>
Queries all open ports associated with the IP address.
-
.with_port_number(number) ⇒ Array<OpenPort>
Queries all open ports with the port number.
-
.with_protocol(protocol) ⇒ Array<OpenPort>
Queries all open ports with the protocol.
-
.with_service_name(name) ⇒ Array<OpenPort>
Queries all open ports associated with the service name.
Instance Method Summary collapse
-
#address ⇒ String
The IP Address of the open port.
-
#number ⇒ Integer
The port number.
-
#to_i ⇒ Integer
Converts the open port to an integer.
-
#to_s ⇒ String
Converts the open port to a string.
Methods included from Model::LastScannedAt
Methods included from Model
Instance Attribute Details
#advisories ⇒ Array<Advisory>
The advisories that the open port is vulnerable to.
111 |
# File 'lib/ronin/db/open_port.rb', line 111 has_many :advisories, through: :vulnerabilities |
#cert ⇒ Cert?
The SSL/TLS certificate used by the open port.
77 |
# File 'lib/ronin/db/open_port.rb', line 77 belongs_to :cert, optional: true |
#created_at ⇒ Time (readonly)
Define the created_at timestamp
83 |
# File 'lib/ronin/db/open_port.rb', line 83 attribute :created_at, :datetime |
#credentials ⇒ Array<Credential>
The credentials that will work with this open port.
95 |
# File 'lib/ronin/db/open_port.rb', line 95 has_many :credentials, through: :service_credentials |
#id ⇒ Integer
The primary key of the open port.
40 |
# File 'lib/ronin/db/open_port.rb', line 40 attribute :id, :integer |
#ip_address ⇒ IPAddress
The IP Address that was scanned.
46 47 |
# File 'lib/ronin/db/open_port.rb', line 46 belongs_to :ip_address, required: true, class_name: 'IPAddress' |
#notes ⇒ Array<Note>
The associated notes.
119 |
# File 'lib/ronin/db/open_port.rb', line 119 has_many :notes, dependent: :destroy |
#port ⇒ Port
The port.
53 |
# File 'lib/ronin/db/open_port.rb', line 53 belongs_to :port, required: true |
#service ⇒ Service?
The service detected on the port
59 |
# File 'lib/ronin/db/open_port.rb', line 59 belongs_to :service, optional: true |
#service_credentials ⇒ Array<ServiceCredential>
Credentials used by the service running on the port
89 |
# File 'lib/ronin/db/open_port.rb', line 89 has_many :service_credentials, dependent: :destroy |
#software ⇒ Software
The software running on the open port
65 |
# File 'lib/ronin/db/open_port.rb', line 65 belongs_to :software, optional: true |
#ssl ⇒ Boolean
Specifies whether the service requires SSL.
71 |
# File 'lib/ronin/db/open_port.rb', line 71 attribute :ssl, :boolean |
#vulnerabilities ⇒ Array<Vulnerability>
The vulnerabilities which reference the open port.
103 |
# File 'lib/ronin/db/open_port.rb', line 103 has_many :vulnerabilities, dependent: :destroy |
Class Method Details
.with_ip_address(address) ⇒ Array<OpenPort>
Queries all open ports associated with the IP address.
185 186 187 |
# File 'lib/ronin/db/open_port.rb', line 185 def self.with_ip_address(address) joins(:ip_address).where(ip_address: {address: address}) end |
.with_port_number(number) ⇒ Array<OpenPort>
Queries all open ports with the port number.
134 135 136 |
# File 'lib/ronin/db/open_port.rb', line 134 def self.with_port_number(number) joins(:port).where(port: {number: number}) end |
.with_protocol(protocol) ⇒ Array<OpenPort>
Queries all open ports with the protocol.
151 152 153 |
# File 'lib/ronin/db/open_port.rb', line 151 def self.with_protocol(protocol) joins(:port).where(port: {protocol: protocol}) end |
.with_service_name(name) ⇒ Array<OpenPort>
Queries all open ports associated with the service name.
168 169 170 |
# File 'lib/ronin/db/open_port.rb', line 168 def self.with_service_name(name) joins(:service).where(service: {name: name}) end |
Instance Method Details
#address ⇒ String
The IP Address of the open port.
197 198 199 |
# File 'lib/ronin/db/open_port.rb', line 197 def address self.ip_address.address end |
#number ⇒ Integer
The port number.
209 210 211 |
# File 'lib/ronin/db/open_port.rb', line 209 def number self.port.number end |
#to_i ⇒ Integer
Converts the open port to an integer.
221 222 223 |
# File 'lib/ronin/db/open_port.rb', line 221 def to_i self.port.to_i end |
#to_s ⇒ String
Converts the open port to a string.
233 234 235 236 237 |
# File 'lib/ronin/db/open_port.rb', line 233 def to_s if self.service then "#{self.ip_address} #{self.port} (#{self.service})" else "#{self.ip_address} #{self.port}" end end |