Module: PWN::Plugins::NmapIt

Defined in:
lib/pwn/plugins/nmap_it.rb

Overview

This plugin is used as an interface to nmap, the exploration tool and security / port scanner.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



55
56
57
58
59
# File 'lib/pwn/plugins/nmap_it.rb', line 55

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/pwn/plugins/nmap_it.rb', line 63

public_class_method def self.help
  puts "USAGE:
    #{self}.port_scan do |nmap|
      puts nmap.public_methods
      nmap.connect_scan = true
      nmap.service_scan = true
      nmap.verbose = true
      nmap.ports = [1..1024,1337]
      nmap.targets = '127.0.0.1'
      nmap.xml = '/tmp/nmap_port_scan_res.xml'
    end

    #{self}.parse_xml_results(:xml_file => 'required - path to nmap xml results') 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

          port.scripts.each do |name,output|
            puts name
            output.each_line { |line| puts line }
          end
        end
      end
    end

    #{self}.authors
  "
end

.parse_xml_results(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::NmapIt.parse_xml_results(:xml_file => ‘required - path to nmap xml results’) do |xml|

puts xml.public_methods
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



43
44
45
46
47
48
49
50
51
# File 'lib/pwn/plugins/nmap_it.rb', line 43

public_class_method def self.parse_xml_results(opts = {})
  xml_file = opts[:xml_file].to_s.scrub.strip.chomp if File.exist?(opts[:xml_file].to_s.scrub.strip.chomp)

  Nmap::XML.new(xml_file) do |xml|
    yield(xml)
  end
rescue StandardError => e
  raise e
end

.port_scanObject

Supported Method Parameters

PWN::Plugins::NmapIt.port_scan do |nmap|

puts nmap.public_methods

end



14
15
16
17
18
19
20
# File 'lib/pwn/plugins/nmap_it.rb', line 14

public_class_method def self.port_scan
  Nmap::Program.scan do |nmap|
    yield(nmap)
  end
rescue StandardError => e
  raise e
end