lib/pwn/plugins/nmap_it.rb in pwn-0.4.571 vs lib/pwn/plugins/nmap_it.rb in pwn-0.4.573

- old
+ new

@@ -1,8 +1,9 @@ # frozen_string_literal: true -require 'nmap' +require 'nmap/command' +require 'nmap/xml' module PWN module Plugins # This plugin is used as an interface to nmap, the exploration tool and security / port scanner. module NmapIt @@ -10,11 +11,11 @@ # PWN::Plugins::NmapIt.port_scan do |nmap| # puts nmap.public_methods # end public_class_method def self.port_scan - Nmap::Program.scan do |nmap| + Nmap::Command.sudo do |nmap| yield(nmap) end rescue StandardError => e raise e end @@ -41,10 +42,10 @@ # end 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| + Nmap::XML.open(xml_file) do |xml| yield(xml) end rescue StandardError => e raise e end