class Nmap::Program
Represents the `nmap` program.
Public Class Methods
scan(options={},exec_options={},&block)
click to toggle source
Finds the `nmap` program and performs a scan.
@param [Hash{Symbol => Object}] options
Additional options for nmap.
@param [Hash{Symbol => Object}] exec_options
Additional exec-options.
@yield [task]
If a block is given, it will be passed a task object used to specify options for nmap.
@yieldparam [Task] task
The nmap task object.
@return [Boolean]
Specifies whether the command exited normally.
@example Specifying Nmap
options via a Hash.
Nmap::Program.scan( :targets => '192.168.1.1', :ports => [22,80,443], :verbose => true )
@example 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
@see scan
# File lib/nmap/program.rb, line 48 def self.scan(options={},exec_options={},&block) find.scan(options,exec_options,&block) end
sudo_scan(options={},exec_options={},&block)
click to toggle source
Finds the `nmap` program and performs a scan, but runs `nmap` under `sudo`.
@see scan
@since 0.8.0
# File lib/nmap/program.rb, line 60 def self.sudo_scan(options={},exec_options={},&block) find.sudo_scan(options,exec_options,&block) end
Public Instance Methods
scan(options={},exec_options={},&block)
click to toggle source
Performs a scan.
@param [Hash{Symbol => Object}] options
Additional options for nmap.
@param [Hash{Symbol => Object}] exec_options
Additional exec-options.
@yield [task]
If a block is given, it will be passed a task object used to specify options for nmap.
@yieldparam [Task] task
The nmap task object.
@return [Boolean]
Specifies whether the command exited normally.
@see rubydoc.info/gems/rprogram/0.3.0/RProgram/Program#run-instance_method
For additional exec-options.
# File lib/nmap/program.rb, line 86 def scan(options={},exec_options={},&block) run_task(Task.new(options,&block),exec_options) end
sudo_scan(options={},exec_options={},&block)
click to toggle source
Performs a scan and runs `nmap` under `sudo`.
@see scan
@since 0.8.0
# File lib/nmap/program.rb, line 97 def sudo_scan(options={},exec_options={},&block) sudo_task(Task.new(options,&block),exec_options) end