Wednesday, 17 February 2016
0 comments

Ruby-Nmap: Nmap Exploration Tool And Security/Port Scanner



Ruby-Nmap: Nmap Exploration Tool And Security/Port Scanner


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.


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


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

Download Link: Click Here


0 comments:

Post a Comment

Note: only a member of this blog may post a comment.

 
Toggle Footer
Top