Definition: It is a ruby version library of Nmap, the exploration tool and security/port scanner.

ย 
Features of ruby-nmap:
ruby-nmap is written in easy-to-understand representation.
When we want to see(Parsing xml generated by the Host Discovery) the mapping of the CLI option is ruby-nmap / lib / nmap / task.rb.
It also provides parser for enumerating nmap XML scan files.
For running nmap, it provides Ruby interface.
[adsense size='1']
Examples of ruby-nmap:
When we Run Nmap from Ruby:
require 'nmap/program'
Nmap::Program.scan do |nmap|
ย  nmap.syn_scan = true
ย  nmap.service_scan = true
ย  nmap.os_fingerprint = true
ย  nmap.xml = 'scan.xml'
ย  nmap.verbose = true
ย  nmap.ports = [20,21,22,23,25,80,110,443,512,522,8080,1080]
ย  nmap.targets = '192.168.1.*'
end
When we Parse Nmap XML scan files:
require 'nmap/xml'
Nmap::XML.new('scan.xml') do |xml|
ย  xml.each_host do |host|
ย  ย  puts "[#{host.ip}]"
ย  ย  host.each_port do |port|
ย  ย  ย  puts " ย #{port.number}/#{port.protocol}\t#{port.state}\t#{port.service}"
ย  ย  end
ย  end
end
[adsense size='4']
When we Print the NSE script output from an XML scan file:
require 'nmap/xml'
Nmap::XML.new('nse.xml') do |xml|
ย  xml.each_host do |host|
ย  ย  puts "[#{host.ip}]"
ย  ย  host.scripts.each do |name,output|
ย  ย  ย  output.each_line { |line| puts " ย #{line}" }
ย  ย  end
ย  ย  host.each_port do |port|
ย  ย  ย  puts " ย [#{port.number}/#{port.protocol}]"
ย  ย  ย  port.scripts.each do |name,output|
ย  ย  ย  ย  puts " ย  ย [#{name}]"
ย  ย  ย  ย  output.each_line { |line| puts " ย  ย  ย #{line}" }
ย  ย  ย  end
ย  ย  end
ย  end
end
Requirements of ruby-nmap:
The basic requirements of ruby-nmap are:
nmap version 5.00
nokogiri version 1.3
0.3 version of rprogram
Installation:
For the installation of ruby-nmap you have to do just the below things:
$ gem install ruby-nmap
License:
License is under The MIT License
Copyright (c) 2009-2014 Postmodern
[adsense size='3']
Download Link: Click Here