【鼎革‧革鼎】︰ Raspbian Stretch 《六之 F.5 》

既然談了 VNC 伺服器,焉能不提及 Karl J. Runge 先生之出類拔萃的

x11vnc: a VNC server for real X displays

x11vnc allows one to view remotely and interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer. In this way it plays the role for Unix/X11 that WinVNC plays for Windows.

It has built-in SSL/TLS encryption and 2048 bit RSA authentication, including VeNCrypt support; UNIX account and password login support; server-side scaling; single port HTTPS/HTTP+VNC; Zeroconf service advertising; and TightVNC and UltraVNC file-transfer. It has also been extended to work with non-X devices: natively on Mac OS X Aqua/Quartz, webcams and TV tuner capture devices, and embedded Linux systems such as Qtopia Core. Full IPv6 support is provided. More features are described here.

It also provides an encrypted Terminal Services mode (-create, -svc, or -xdmsvc options) based on Unix usernames and Unix passwords where the user does not need to memorize his VNC display/port number. Normally a virtual X session (Xvfb) is created for each user, but it also works with X sessions on physical hardware. See the tsvnc terminal services mode of the SSVNC viewer for one way to take advantage of this mode.

I wrote x11vnc back in 2002 because x0rfbserver was basically impossible to build on Solaris and had poor performance. The primary x0rfbserver build problems centered around esoteric C++ toolkits. x11vnc is written in plain C and needs only standard libraries and so should work on nearly all Unixes, even very old ones. I also created enhancements to improve the interactive response, added many features, and etc.

This page including the FAQ contains much information [*]; solutions to many problems; and interesting applications, but nevertheless please feel free to contact me if you have problems or questions (and if I save you time or expense by giving you some of my time, please consider a PayPal Donation.) Do check the FAQ and this page first; I realize the pages are massive, but you can often use your browser’s find-in-page search action using a keyword to find the answer to your problem or question.

SSVNC:  An x11vnc side-project provides an Enhanced TightVNC Viewer package (SSVNC) for Unix, Windows, and Mac OS X with automatic SSL and/or SSH tunnelling support, SSL Certificate creation, Saved connection profiles, Zeroconf, VeNCrypt, and built-in Proxy support. Added features for the TightVNC Unix viewer: NewFBSize, ZRLE encoding, Viewer-side Scaling, cursor alphablending, low color modes, and enhanced popup menu; UltraVNC extensions support for: File Transfer, Text Chat, Single Window, Server Input, and 1/n Scaling extensions, and UltraVNC DSM encryption. The SSVNC bundle could be placed on, say, a USB memory stick for SSL/SSH VNC viewing from nearly any networked computer.

 

程式也!舉例來說,在樹莓派上如何作逆向 VNC 連接的呢?

Starting Listening VNC Viewer and establishing a reverse connection

You can establish a reverse connection to a Listening VNC Viewer, allowing the Viewer user to bypass the authentication scheme and control the Server User’s computer. When a connection is made in this way, VNC Viewer does not connect to VNC Server, but instead waits for VNC Server to connect to it.

This feature is useful if your computer is protected by a firewall that cannot be configured to allow – or by a router that cannot be configured to forward – network communications, thus preventing incoming connections. In a reverse connection, network communications from the Server user’s computer are outgoing.

Note: Reverse connections are not secure and should only be used in a locked-down environment.

Configuring Listening VNC Viewer

Starting Listening VNC Viewer

  •   Under Windows or Mac OS X, search for or navigate to the Listening VNC Viewer program.
  •   Under UNIX, you must start Listening VNC Viewer at the command line. If VNC Viewer is installed on your system, run:

vncviewer –listen [<port>]

If you use the standalone version of VNC Viewer, run:

./<download-file> -listen [<port>]

 

【觀看客戶端】

vncviewer -listen 5500

 

【伺服器端】

x11vnc -connect 觀看客戶端 IP :5500

 

就得了!?還可藉此工具了解 VNC 規範連線效能以及選項運用?!將能自製酪梨 client 乎!!??

PyGuacamole

A Python client library for communication with Guacamole server (guacd)

Installation

Using pip

pip install pyguacamole</pre> <span style="color: #808080;">From source</span> <pre class="lang:default decode:true "> python setup.py install

Usage

GuacamoleClient handles communication with a running guacd server via Guacamole Protocol.

GuacamoleClient must be used by a broker server which handles communication with a Javscript application running in the browser. GuacamoleClient implements the methods that enables communication with guacd server (send & receive).

First step should be establishing handshake with guacd server, then Broker server should handle instruction sending and receiving:

  • send: send instruction to guacd server
  • receive: receive instruction from guacd server

……

 

唯因目前其喜派生二 Python ︰

pi@raspberrypi:~ sudo pip install pyguacamole Collecting pyguacamole   Downloading pyguacamole-0.6.tar.gz Collecting future>=0.15.2 (from pyguacamole)   Downloading future-0.16.0.tar.gz (824kB)     100% |████████████████████████████████| 829kB 298kB/s  Requirement already satisfied: six>=1.10.0 in /usr/lib/python2.7/dist-packages (from pyguacamole) Building wheels for collected packages: pyguacamole, future   Running setup.py bdist_wheel for pyguacamole ... done   Stored in directory: /root/.cache/pip/wheels/f9/6d/74/876c143097972169cef3fa99508be9b37f3564400f46baa236   Running setup.py bdist_wheel for future ... done   Stored in directory: /root/.cache/pip/wheels/c2/50/7c/0d83b4baac4f63ff7a765bd16390d2ab43c93587fac9d6017a Successfully built pyguacamole future Installing collected packages: future, pyguacamole Successfully installed future-0.16.0 pyguacamole-0.6  pi@raspberrypi:~ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170124] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from guacamole.client import GuacamoleClient
>>> client = GuacamoleClient('127.0.0.1', 4822)
>>> client.handshake(protocol='rdp', hostname='localhost', port=3389)
>>> instruction = client.receive()
>>> instruction
'4.size,1.0,4.1024,3.768;'
>>> instruction = '5.mouse,3.400,3.500;'
>>> client.send(instruction)
>>> 

 

故待挺進派生三的呦??!!

pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from guacamole.client import GuacamoleClient
>>> client = GuacamoleClient('127.0.0.1', 4822)
>>> client.handshake(protocol='vnc', hostname='localhost', port=5900)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/guacamole/client.py", line 158, in handshake
    self.send_instruction(Instruction('select', protocol))
  File "/usr/local/lib/python3.5/dist-packages/guacamole/client.py", line 136, in send_instruction
    return self.send(instruction.encode())
  File "/usr/local/lib/python3.5/dist-packages/guacamole/client.py", line 122, in send
    self.client.sendall(data)
TypeError: a bytes-like object is required, not 'str'
>>>