
Ein Ruby-Interface zu nmap, dem Erkundungswerkzeug und Sicherheits-/Port-Scanner. Ermöglicht das Automatisieren von nmap und das Parsen von nmap-XML-Dateien.
Eine Ruby-API für nmap, das Erkundungstool und Sicherheits-/Portscanner. Ermöglicht die Automatisierung von nmap und das Parsen von nmap-XML-Dateien.
Nmap von Ruby aus ausführen:
require 'nmap/command'
Nmap::Command.run do |nmap|
nmap.connect_scan = true
nmap.service_scan = true
nmap.output_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
sudo nmap von Ruby aus ausführen:
require 'nmap/command'
Nmap::Command.sudo do |nmap|
nmap.syn_scan = true
nmap.os_fingerprint = true
nmap.service_scan = true
nmap.output_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
Nmap-XML-Scandateien parsen:
require 'nmap/xml'
Nmap::XML.open('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
NSE-Skriptausgabe aus einer XML-Scandatei ausgeben:
require 'nmap/xml'
Nmap::XML.open('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 |id,script|
puts " [#{id}]"
script.output.each_line { |line| puts " #{line}" }
end
end
end
end
$ sudo apt install nmap
$ sudo dnf install nmap
$ brew install nmap
$ gem install ruby-nmap
Siehe {file:LICENSE.txt} für Lizenzinformationen.