lib/wmap/port_scanner.rb
# A simple TCP port scanner. This is the basic element of the port scanner. Notice the default time-out is set by the default instance variable @socket_timeout
A simple TCP port scanner. This is the basic element of the port scanner. Notice the default time-out is set by the default instance variable @socket_timeout
A simple TCP port scanner . This is the basic element of the port scanner . Notice the default time - out is set by the default instance variable @socket_timeout
def tcp_port_open? (host,port)
		puts "Perform open port detection on: #{host}:#{port}, time-out: #{@socket_timeout} ms" if @verbose
		timeo = @socket_timeout/1000.0						
		begin
            if Net::Ping::TCP.new(host,port,timeo).ping
				puts "Port open!" if @verbose
                return true
            else
				puts "Port down." if @verbose
                return false
            end
		rescue Exception => ee
			puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose
			return false
		end
	end
def tcp_port_open? ( host , port ) puts "Perform open port detection on: #{host}:#{port}, time-out: #{@socket_timeout} ms" if @verbose timeo = @socket_timeout / 1000.0 begin if Net :: Ping :: TCP . new ( host , port , timeo ) . ping puts "Port open!" if @verbose return true else puts "Port down." if @verbose return false end rescue Exception => ee puts "Exception on method #{__method__} for #{host}: #{ee}" if @verbose return false end end
A simple TCP port scanner.
A simple TCP port scanner .
#@socket_timeout = socket_timeout # change time-out unit from sec to ms
host
<not_specific>
port
<not_specific>