def port_open?(ip, port, seconds = 10)
      Timeout.timeout(seconds) do
        TCPSocket.new(ip, port).close
        true
      end
    rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError, Timeout::Error
      false
    end
def port_open?(ip, port, seconds = 10)
      Timeout.timeout(seconds) do
        TCPSocket.new(ip, port).close
        true
      end
    rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError, Timeout::Error
      false
    end
Start the local server and listen for connections

 @param [SSRFProxy::HTTP] ssrf A configured SSRFProxy::HTTP object
 @param [String] interface Listen interface (Default: 127.0.0.1)
 @param [Integer] port Listen port (Default: 8081)

 @raise [SSRFProxy::Server::Error::InvalidSsrf]
        Invalid SSRFProxy::SSRF object provided.
 @raise [SSRFProxy::Server::Error::ProxyRecursion]
        Proxy recursion error. SSRF Proxy cannot use itself as an
        upstream proxy.
 @raise [SSRFProxy::Server::Error::RemoteProxyUnresponsive]
        Could not connect to remote proxy.
 @raise [SSRFProxy::Server::Error::AddressInUse]
        Could not bind to the port on the specified interface as
        address already in use.

 @example Start SSRF Proxy server with the default options
   ssrf_proxy = SSRFProxy::Server.new(
     SSRFProxy::HTTP.new('http://example.local/?url=xxURLxx'),
     '127.0.0.1',
     8081)
   ssrf_proxy.serve


 Checks if a port is open or not on a remote host
 From: https://gist.github.com/ashrithr/5305786

 @param [String] ip connect to IP
 @param [Integer] port connect to port
 @param [Integer] seconds connection timeout