lib/wmap/network_profiler.rb
# Perform raw socket ICMP echo detection on the host. Note that socket ICMP packet manipulation 
#  need the root privilege access(for example, ICMP 'echo' need to snoop on the interface to detect any replies such as 'ECONNREFUSED'). 
#  That's why we also use external ping program for the normal users in case they do not has the access.
Perform raw socket ICMP echo detection on the host. Note that socket ICMP packet manipulation
need the root privilege access(for example, ICMP 'echo' need to snoop on the interface to detect any replies such as 'ECONNREFUSED').
That's why we also use external ping program for the normal users in case they do not has the access.
Perform raw socket ICMP echo detection on the host . Note that socket ICMP packet manipulation need the root privilege access ( for example ICMP ' echo ' need to snoop on the interface to detect any replies such as ' ECONNREFUSED ' ) . That ' s why we also use external ping program for the normal users in case they do not has the access .
def socket_icmp_pingable? (target)
		puts "Perform socket ICMP ping on the target: #{target}" if @verbose
		begin
			timeo = @socket_timeout/1000.0						
			p=Net::Ping::ICMP.new(target,nil,timeo) 
			if p.ping
				@latency=p.duration * 1000
				puts "Socket ICMP echo test successful on #{target}." if @verbose
				return true
			else
				puts "Socket ICMP echo test fail on #{target}." if @verbose
				return false
			end
		rescue Exception => ee
			puts "Error on method #{__method__} on target #{target}: #{ee}" if @verbose
			return false
		end
	end
def socket_icmp_pingable? ( target ) puts "Perform socket ICMP ping on the target: #{target}" if @verbose begin timeo = @socket_timeout / 1000.0 p = Net :: Ping :: ICMP . new ( target , nil , timeo ) if p . ping @latency = p . duration * 1000 puts "Socket ICMP echo test successful on #{target}." if @verbose return true else puts "Socket ICMP echo test fail on #{target}." if @verbose return false end rescue Exception => ee puts "Error on method #{__method__} on target #{target}: #{ee}" if @verbose return false end end
Perform raw socket ICMP echo detection on the host.
Perform raw socket ICMP echo detection on the host .
# change time-out unit from sec to ms
target
<not_specific>