Class: Nmap::XML::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/nmap/xml/script.rb

Overview

Wraps a script XML element.

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Script

Initializes a new Script object.

Parameters:

  • node (Nokogiri::XML::Node)

    The XML node that contains the host information.

Since:

  • 1.0.0



18
19
20
# File 'lib/nmap/xml/script.rb', line 18

def initialize(node)
  @node = node
end

Instance Method Details

#dataHash{String => Hash,Array,String}, ...

Parses the structured data within the <script> XML element.

Returns:

  • (Hash{String => Hash,Array,String}, Array<Hash>, Array<String>, nil)

    The parsed data.

Since:

  • 1.0.0



46
47
48
# File 'lib/nmap/xml/script.rb', line 46

def data
  @data ||= parse_table(@node)
end

#idString

The ID of the NSE script.

Returns:

  • (String)

Since:

  • 1.0.0



27
28
29
# File 'lib/nmap/xml/script.rb', line 27

def id
  @id ||= @node['id']
end

#outputString

The text output from the NSE script.

Returns:

  • (String)

Since:

  • 1.0.0



36
37
38
# File 'lib/nmap/xml/script.rb', line 36

def output
  @output ||= @node['output']
end