Class: Nmap::XML::ScanTask

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

Overview

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, start_time, end_time, extra_info = nil) ⇒ ScanTask

Creates a new ScanTask object.

Parameters:

  • name (String)

    The name of the scan task.

  • start_time (Time)

    The time the scan task begun.

  • end_time (Time)

    The time the scan task ended.

  • extra_info (String) (defaults to: nil)

    Any extra information relating to the scan task.

Since:

  • 0.1.2



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

def initialize(name,start_time,end_time,extra_info=nil)
  super
end

Instance Attribute Details

#end_timeObject

Returns the value of attribute end_time

Returns:

  • (Object)

    the current value of end_time



8
9
10
# File 'lib/nmap/xml/scan_task.rb', line 8

def end_time
  @end_time
end

#extra_infoObject

Returns the value of attribute extra_info

Returns:

  • (Object)

    the current value of extra_info



8
9
10
# File 'lib/nmap/xml/scan_task.rb', line 8

def extra_info
  @extra_info
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/nmap/xml/scan_task.rb', line 8

def name
  @name
end

#start_timeObject

Returns the value of attribute start_time

Returns:

  • (Object)

    the current value of start_time



8
9
10
# File 'lib/nmap/xml/scan_task.rb', line 8

def start_time
  @start_time
end

Instance Method Details

#durationInteger

The duration of the scan task.

Returns:

  • (Integer)

    The number of seconds it took the scan task to complete.

Since:

  • 0.1.2



39
40
41
# File 'lib/nmap/xml/scan_task.rb', line 39

def duration
  (self.end_time - self.start_time)
end

#to_sString

Converts the scan task to a String.

Returns:

  • (String)

    The String form of the scan task.

Since:

  • 0.1.2



51
52
53
# File 'lib/nmap/xml/scan_task.rb', line 51

def to_s
  "#{self.start_time}: #{self.name} (#{self.extra_info})"
end