Class: Nmap::ScanTask

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, start_time, end_time, extrainfo = 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.

  • extrainfo (String) (defaults to: nil)

    Any extra information relating to the scan task.

Since:

  • 0.1.2



33
34
35
36
37
38
# File 'lib/nmap/scan_task.rb', line 33

def initialize(name,start_time,end_time,extrainfo=nil)
  @name = name
  @start_time = start_time
  @end_time = end_time
  @extrainfo = extrainfo
end

Instance Attribute Details

#end_timeObject (readonly)

The time the scan task ended



11
12
13
# File 'lib/nmap/scan_task.rb', line 11

def end_time
  @end_time
end

#extrainfoObject (readonly)

Extra information on the scan task



14
15
16
# File 'lib/nmap/scan_task.rb', line 14

def extrainfo
  @extrainfo
end

#nameObject (readonly)

The name of the scan task



5
6
7
# File 'lib/nmap/scan_task.rb', line 5

def name
  @name
end

#start_timeObject (readonly)

The time the scan task begun



8
9
10
# File 'lib/nmap/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



48
49
50
# File 'lib/nmap/scan_task.rb', line 48

def duration
  (@end_time - @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



60
61
62
# File 'lib/nmap/scan_task.rb', line 60

def to_s
  "#{@start}: #{@name} (#{@extrainfo})"
end