lib/wmap/network_profiler.rb
# Main worker method that determine the right profiling methods
Main worker method that determine the right profiling methods
Main worker method that determine the right profiling methods
def profile(host)	
		puts "Perform web service discovery on host: #{host}" if @verbose
		@latency = @socket_timeout
		begin
			if Process.euid == 0 && socket_icmp_pingable?(host)
				puts "Network profiling by using raw socket ..." if @verbose
			elsif shell_ping_exist? && shell_pingable?(host)
				puts "Network profiling by using external shell ping program ..." if @verbose
			elsif open_tcp_port?(host)
				puts "Network profiling by using TCP ping ..." if @verbose
			else
				puts "No appropriate profiling method for #{host}" if @verbose
			end
			puts "Found network latency for #{host}: #{@latency} ms" if @verbose
			return @latency
		rescue Exception => ee
			puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
			return nil
		end
	end
def profile ( host ) puts "Perform web service discovery on host: #{host}" if @verbose @latency = @socket_timeout begin if Process . euid == 0 && socket_icmp_pingable? ( host ) puts "Network profiling by using raw socket ..." if @verbose elsif shell_ping_exist? && shell_pingable? ( host ) puts "Network profiling by using external shell ping program ..." if @verbose elsif open_tcp_port? ( host ) puts "Network profiling by using TCP ping ..." if @verbose else puts "No appropriate profiling method for #{host}" if @verbose end puts "Found network latency for #{host}: #{@latency} ms" if @verbose return @latency rescue Exception => ee puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose return nil end end
Main worker method that determine the right profiling methods
Main worker method that determine the right profiling methods
# Do nothing
host
<not_specific>