Class: Ronin::DB::MACAddress
- Defined in:
- lib/ronin/db/mac_address.rb
Overview
Represents MAC addresses and their associated IP addresses.
Instance Attribute Summary collapse
-
#address ⇒ String
The MAC address.
-
#advisories ⇒ Array<Advisory>
The advisories that the MAC Address is vulnerable to.
-
#ip_address_mac_addresses ⇒ Array<IPAddressMACAddress>
The IP Addresses the MAC Address hosts.
-
#ip_addresses ⇒ Array<IPAddress>
The IP Addresses associated with the MAC Address.
-
#notes ⇒ Array<Note>
The associated notes.
-
#vulnerabilities ⇒ Array<Vulnerability>
The vulnerabilities which reference the MAC Address.
Attributes inherited from Address
Attributes included from Ronin::DB::Model::LastScannedAt
Instance Method Summary collapse
-
#recent_ip_address ⇒ IPAddress
The IP Address that most recently used the MAC Address.
-
#to_i ⇒ Integer
Converts the MAC address to an Integer.
Methods inherited from Address
Methods included from Ronin::DB::Model::LastScannedAt
Methods included from Ronin::DB::Model::Importable
Methods included from Model
Instance Attribute Details
#address ⇒ String
The MAC address.
37 |
# File 'lib/ronin/db/mac_address.rb', line 37 attribute :address, :string |
#advisories ⇒ Array<Advisory>
The advisories that the MAC Address is vulnerable to.
74 |
# File 'lib/ronin/db/mac_address.rb', line 74 has_many :advisories, through: :vulnerabilities |
#ip_address_mac_addresses ⇒ Array<IPAddressMACAddress>
The IP Addresses the MAC Address hosts
50 51 |
# File 'lib/ronin/db/mac_address.rb', line 50 has_many :ip_address_mac_addresses, dependent: :destroy, class_name: 'IPAddressMACAddress' |
#ip_addresses ⇒ Array<IPAddress>
The IP Addresses associated with the MAC Address
57 58 |
# File 'lib/ronin/db/mac_address.rb', line 57 has_many :ip_addresses, through: :ip_address_mac_addresses, class_name: 'IPAddress' |
#notes ⇒ Array<Note>
The associated notes.
82 |
# File 'lib/ronin/db/mac_address.rb', line 82 has_many :notes, dependent: :destroy |
#vulnerabilities ⇒ Array<Vulnerability>
The vulnerabilities which reference the MAC Address.
66 |
# File 'lib/ronin/db/mac_address.rb', line 66 has_many :vulnerabilities, dependent: :destroy |
Instance Method Details
#recent_ip_address ⇒ IPAddress
The IP Address that most recently used the MAC Address.
92 93 94 |
# File 'lib/ronin/db/mac_address.rb', line 92 def recent_ip_address self.ip_address_mac_addresses.order('created_at DESC').ip_addresses.first end |
#to_i ⇒ Integer
Converts the MAC address to an Integer.
104 105 106 107 108 |
# File 'lib/ronin/db/mac_address.rb', line 104 def to_i self.address.split(':').reduce(0) do |bits,char| ((bits << 8) | char.hex) end end |