eval_scans.rb 752 B

123456789101112131415161718192021222324
  1. require 'nmap/xml'
  2. Dir["scan_*.xml"].each { |file|
  3. if File.readable? file
  4. Nmap::XML.new(file) do |xml|
  5. xml.each_host do |host|
  6. host.each_port do |port|
  7. #p $open_ports[port.number].length
  8. #$open_ports[port.number] << [host.ip, port.protocol, port.reason, port.service.to_s, port.state] if port.state == :open
  9. #p [host.ip, port.protocol, port.reason, port.service.to_s, port.state]
  10. if port.state == :open
  11. puts "#{port.number} service #{port.service.to_s} IP #{host.ip} "
  12. end
  13. end
  14. end
  15. end
  16. else
  17. STDERR.puts "#{file} is not readable"
  18. end
  19. }