Class: ScanDB::Host

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/scandb/host.rb

Constant Summary

Constants included from Model

Model::REPOSITORY_NAME

Instance Method Summary collapse

Methods included from Model

included

Instance Method Details

#best_class_guessObject

Returns the best OS Class guess.



69
70
71
# File 'lib/scandb/host.rb', line 69

def best_class_guess
  os_class_guesses.first
end

#best_match_guessObject

Returns the best OS Match guess.



76
77
78
# File 'lib/scandb/host.rb', line 76

def best_match_guess
  os_match_guesses.first
end

#closed_portsObject

Returns all the closed ports on the host.



97
98
99
# File 'lib/scandb/host.rb', line 97

def closed_ports
  scanned_ports.all(:status => :closed)
end

#filtered_portsObject

Returns all the filtered ports on the host.



90
91
92
# File 'lib/scandb/host.rb', line 90

def filtered_ports
  scanned_ports.all(:status => :filtered)
end

#host_nameObject

Returns the primary host name.



62
63
64
# File 'lib/scandb/host.rb', line 62

def host_name
  names.first
end

#open_portsObject Also known as: ports

Returns all the open ports on the host.



83
84
85
# File 'lib/scandb/host.rb', line 83

def open_ports
  scanned_ports.all(:status => :open)
end

#port_numbersObject

Returns the ports numbers of all open ports on the host.



106
107
108
# File 'lib/scandb/host.rb', line 106

def port_numbers
  open_ports.map { |port| port.number }
end

#servicesObject

Returns the services of all open ports on the host.



113
114
115
# File 'lib/scandb/host.rb', line 113

def services
  ports.service
end

#to_sObject

Returns the IP address of the host in String form.



120
121
122
# File 'lib/scandb/host.rb', line 120

def to_s
  ip
end