0

How can I connect to Xapi-style urls such as https://192.168.1.45/console?uuid=e82eeea4-4d88-d31a-aabd-c4207ca6c24d with a normal vnc client?

Remmina seems to straight up crash with that as the host, and trying to use a socat proxy also closes the connection.

KRDC and TigerVNC get confused, Vinagre gives an error, and Remmina crashes or hangs.

The documentation shows that it's a non-standard https proxy, and I am wondering there is a Linux VNC client with this proxy support built in, or a command I can run to do the http connect directly?

byteit101
  • 111

1 Answers1

0

I ended up writing a simple proxy in Ruby to do this. Run as ruby thisscript.rb xapi-url yourusername

require 'socket'
require 'base64'
require 'openssl'
require 'uri'

def connect(uri, auth) ss = TCPSocket.new uri.host, uri.port ssl_socket = if uri.scheme == "https" ssl_context = OpenSSL::SSL::SSLContext.new() ssl_socket = OpenSSL::SSL::SSLSocket.new(ss, ssl_context) ssl_socket.sync_close = true ssl_socket.connect ssl_socket else ss end ssl_socket.puts("CONNECT #{uri.path}?#{uri.query} HTTP/1.1\r\nAuthorization: Basic #{Base64.encode64(auth)}\r\n\r\n")

begin
    text = ""
    until text.include? "\r\n\r\n"
        text << ssl_socket.readpartial(1024).tap{|x|print x}
    end
    text = nil
ensure
    puts text if text
end
return ssl_socket

end

listening = TCPServer.new 5903 uri = URI(ARGV[0]) username = ARGV[1] ARGV.shift ARGV.shift print "Enter Password for #{username}: " pass = gets.strip loop do clent = listening.accept puts "Connecting..." ssl_socket = connect(uri, "#{username}:#{pass}")

Thread.new do 
    # XEN -> VNC
    begin 
        loop do
            clent.write ssl_socket.readpartial(4096)
        end
    rescue EOFError
        client.close rescue nil
        ssl_socket.close rescue nil
    end
end 
# VNC -> XEN
begin 
    loop do
        ssl_socket.write clent.readpartial(4096)
    end
rescue EOFError
    client.close rescue nil
    ssl_socket.close rescue nil
end
puts "Closed stream"

end

byteit101
  • 111