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



16
17
18
# File 'lib/nmap/xml/script.rb', line 16

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



44
45
46
# File 'lib/nmap/xml/script.rb', line 44

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

#idString

The ID of the NSE script.

Returns:

  • (String)

Since:

  • 1.0.0



25
26
27
# File 'lib/nmap/xml/script.rb', line 25

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

#outputString

The text output from the NSE script.

Returns:

  • (String)

Since:

  • 1.0.0



34
35
36
# File 'lib/nmap/xml/script.rb', line 34

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