lib/wmap/network_profiler.rb
# Perform TCP Ping as a last resort of the network profiling effort, in case of ICMP tests fail.
Perform TCP Ping as a last resort of the network profiling effort, in case of ICMP tests fail.
Perform TCP Ping as a last resort of the network profiling effort in case of ICMP tests fail .
def open_tcp_port? (target)
		puts "Check if any TCP port in the list #{@discovery_tcp_ports} is open on the remote host: #{target}" if @verbose
		begin
			timeo = @socket_timeout/1000.0						
			p=Net::Ping::TCP.new(target,nil,timeo) 
			@discovery_tcp_ports.map do |port|
				p.port=port
				if p.ping
					@which_port=port	
					@latency = p.duration * 1000 * 100
					puts "TCP port detection successful on port: #{@which_port}" if @verbose
					return true
				end
			end
			puts "TCP port detection on remote host #{target} fail. " if @verbose
			return false
		rescue Exception => ee
			puts "Error on method #{__method__} on target #{target}: #{ee}" if @verbose
			return false
		end
	end
def open_tcp_port? ( target ) puts "Check if any TCP port in the list #{@discovery_tcp_ports} is open on the remote host: #{target}" if @verbose begin timeo = @socket_timeout / 1000.0 p = Net :: Ping :: TCP . new ( target , nil , timeo ) @discovery_tcp_ports . map do | port | p . port = port if p . ping @which_port = port @latency = p . duration * 1000 * 100 puts "TCP port detection successful on port: #{@which_port}" if @verbose return true end end puts "TCP port detection on remote host #{target} fail. " if @verbose return false rescue Exception => ee puts "Error on method #{__method__} on target #{target}: #{ee}" if @verbose return false end end
Perform TCP Ping as a last resort of the network profiling effort, in case of ICMP tests fail.
Perform TCP Ping as a last resort of the network profiling effort in case of ICMP tests fail .
# change time-out unit from sec to ms # Bug in the current Net::Ping.ping module, where the 'duration' is 100 order off. We make it up here without fixing their code
target
<not_specific>