Class: Ronin::Scanners::Nmap

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.scan(options = {}, &block) ⇒ Object

Perform an Nmap scan using the given options and block. If a block is given, it will be passed a newly created NmapTask object.



41
42
43
# File 'lib/ronin/scanners/nmap/nmap.rb', line 41

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

Instance Method Details

#import_scan(options = {}, &block) ⇒ Object

Perform an Nmap scan using the given options and save the resulting scan information into ScanDB. If a block is given, it will be passed each ScanDB::Host object from the scan.



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ronin/scanners/nmap/nmap.rb', line 59

def import_scan(options={},&block)
  file = Tempfile.new('nmap',Config::TMP_DIR)

  # perform the scan
  scan(options.merge(:xml => file))

  # import the xml file into ScanDB
  hosts = ScanDB::Nmap.import_xml(file,&block)

  file.delete
  return hosts
end

#scan(options = {}, &block) ⇒ Object

Perform an Nmap scan using the given options and block. If a block is given, it will be passed a newly created NmapTask object.



50
51
52
# File 'lib/ronin/scanners/nmap/nmap.rb', line 50

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