Class: Nmap::Program

Inherits:
RProgram::Program
  • Object
show all
Defined in:
lib/nmap/program.rb

Overview

Represents the nmap program.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.scan(options = {}, exec_options = {}) {|task| ... } ⇒ Boolean

Finds the nmap program and performs a scan.

Examples:

Specifying Nmap options via a Hash.

Nmap::Program.scan(
  :targets => '192.168.1.1',
  :ports => [22,80,443],
  :verbose => true
)

Specifying Nmap options via a Task object.

Nmap::Program.scan do |nmap|
  nmap.targets = '192.168.1.1'
  nmap.ports = [22,80,443]
  nmap.verbose = true
end

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    Additional options for nmap.

  • exec_options (Hash{Symbol => Object}) (defaults to: {})

    Additional exec-options.

Yields:

  • (task)

    If a block is given, it will be passed a task object used to specify options for nmap.

Yield Parameters:

  • task (Task)

    The nmap task object.

Returns:

  • (Boolean)

    Specifies whether the command exited normally.

See Also:



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

def self.scan(options={},exec_options={},&block)
  find.scan(options,exec_options,&block)
end

Instance Method Details

#scan(options = {}, exec_options = {}) {|task| ... } ⇒ Boolean

Performs a scan.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    Additional options for nmap.

  • exec_options (Hash{Symbol => Object}) (defaults to: {})

    Additional exec-options.

Yields:

  • (task)

    If a block is given, it will be passed a task object used to specify options for nmap.

Yield Parameters:

  • task (Task)

    The nmap task object.

Returns:

  • (Boolean)

    Specifies whether the command exited normally.

See Also:



74
75
76
# File 'lib/nmap/program.rb', line 74

def scan(options={},exec_options={},&block)
  run_task(Task.new(options,&block),exec_options)
end