module Nmapr

Constants

VERSION

Public Class Methods

run(cmd) { |results| ... } click to toggle source
# File lib/nmapr.rb, line 19
def self.run(cmd)
  results = Hash.new
  stdout, stderr, status = Open3.capture3(cmd)
  results[:stdout] = stdout
  results[:stderr] = stderr
  results[:status] = status
  return results unless block_given?
  yield results
end
scan(type = :object, &block) click to toggle source
# File lib/nmapr.rb, line 6
def self.scan(type = :object, &block)
  scan = Scanner.new
  scan.instance_eval(&block)
  case type
  when :object
    scan 
  when :cmd
    scan.to_cmd
  when :run
    run(scan.to_cmd)
  end
end