Parent

Nmap::Parser::Host::OS

This holds the OS information from OS Detection

Attributes

fingerprint[R]

OS fingerprint

Public Class Methods

new(os) click to toggle source
# File lib/nmap/parser.rb, line 1372
def initialize(os)
        parse(os)
end

Public Instance Methods

all_names() click to toggle source

Returns an array of names from all OS records, and passes them each to a block if one is given

# File lib/nmap/parser.rb, line 1318
def all_names() # :yields: name
        names = []

        @osmatches.each do |match|
                names << match.name
                yield match.name if block_given?
        end

        names
end
Also aliased as: names
class_accuracy(index = 0) click to toggle source

Returns OS class accuracy of the first OS class record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1257
def class_accuracy(index = 0)
        return nil if @osclasses.empty?

        @osclasses[index.to_i].accuracy
end
class_count() click to toggle source

Returns the number of OS class records

# File lib/nmap/parser.rb, line 1251
def class_count
        @osclasses.size
end
name(index = 0) click to toggle source

Returns name of first OS match record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1302
def name(index = 0)
        return nil if @osmatches.empty?

        @osmatches[index.to_i].name
end
name_accuracy(index = 0) click to toggle source

Returns OS name accuracy of the first OS match record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1310
def name_accuracy(index = 0)
        return nil if @osmatches.empty?

        @osmatches[index.to_i].accuracy
end
name_count() click to toggle source

Returns the number of OS match records

# File lib/nmap/parser.rb, line 1296
def name_count
        @osmatches.size
end
names() click to toggle source
Alias for: all_names
osclasses() click to toggle source

Returns an array of OSClass objects, and passes them each to a block if one is given

# File lib/nmap/parser.rb, line 1236
def osclasses
        @osclasses.each { |osclass| yield osclass } if block_given?

        @osclasses
end
osfamily(index = 0) click to toggle source

Returns OS family information of first OS class record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1265
def osfamily(index = 0)
        return nil if @osclasses.empty?

        @osclasses[index.to_i].osfamily
end
osgen(index = 0) click to toggle source

Returns OS generation information of first OS class record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1273
def osgen(index = 0)
        return nil if @osclasses.empty?

        @osclasses[index.to_i].osgen
end
osmatches() click to toggle source

Returns an array of OSMatch objects, and passes them each to a block if one is given

# File lib/nmap/parser.rb, line 1244
def osmatches
        @osmatches.each { |osmatch| yield osmatch } if block_given?

        @osmatches
end
ostype(index = 0) click to toggle source

Returns OS type information of the first OS class record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1281
def ostype(index = 0)
        return nil if @osclasses.empty?

        @osclasses[index.to_i].ostype
end
osvendor(index = 0) click to toggle source

Returns OS vendor information of the first OS class record, or Nth record as specified by index

# File lib/nmap/parser.rb, line 1289
def osvendor(index = 0)
        return nil if @osclasses.empty?

        @osclasses[index.to_i].osvendor
end
tcpport_closed() click to toggle source

Returns the closed TCP port used for this OS Detection run

# File lib/nmap/parser.rb, line 1332
def tcpport_closed
        return nil if @portsused.nil?

        @portsused.each do |port|
                if port.proto == "tcp" and port.state == "closed"
                        return port.num
                end
        end

        nil
end
tcpport_open() click to toggle source

Returns the open TCP port used for this OS Detection run

# File lib/nmap/parser.rb, line 1345
def tcpport_open
        return nil if @portsused.nil?

        @portsused.each do |port|
                if port.proto == "tcp" and port.state == "open"
                        return port.num
                end
        end

        nil
end
udpport_closed() click to toggle source

Returns the closed UDP port used for this OS Detection run

# File lib/nmap/parser.rb, line 1358
def udpport_closed
        return nil if @portsused.nil?

        @portsused.each do |port|
                if port.proto == "udp" and port.state == "closed"
                        return port.num
                end
        end

        nil
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.