Library vnc

The VNC library provides some basic functionality needed in order to communicate with VNC servers, and derivatives such as Tight- or Ultra- VNC.

Summary ------- The library currently supports the VNC Authentication security type only. This security type is supported by default in VNC, TightVNC and "Remote Desktop Sharing" in eg. Ubuntu. For servers that do not support this authentication security type the login method will fail.

Overview -------- The library contains the following classes:

o VNC - This class contains the core functions needed to communicate with VNC

Source: https://svn.nmap.org/nmap/nselib/vnc.lua

Functions

client_init (self, shared)

Send a ClientInit message.

connect (self)

Connects the VNC socket

createVNCDESKey (self, password)

Creates the password bit-flip needed before DES encryption

disconnect (self)

Disconnects the VNC socket

encryptVNCDES (self, password, challenge)

Encrypts a password with the server's challenge to create the challenge response

getProtocolVersion (self, version)

Returns the protocol version reported by the server

getSecTypesAsTable (self)

Returns all supported security types as a table

handshake (self)

Performs the VNC handshake and determines

  • The RFB Protocol to use
  • The supported authentication security types
login (self, username, password, authtype)

Attempts to login to the VNC service using any supported method

login_vncauth (self, username, password)

Attempts to login to the VNC service using VNC Authentication

supportsSecType (self, sectype)

Checks if the supplied security type is supported or not

Functions

client_init (self, shared)

Send a ClientInit message.

Parameters

self
 
shared
boolean determining whether the screen should be shared, or whether other logged-on users should be booted.

Return values:

  1. status true if message was successful, false otherwise
  2. table containing contents of ServerInit message, or error message.
connect (self)

Connects the VNC socket

Parameters

self
 
createVNCDESKey (self, password)

Creates the password bit-flip needed before DES encryption

Parameters

self
 
password
string containing the password to process

Return value:

password string containing the processed password
disconnect (self)

Disconnects the VNC socket

Parameters

self
 
encryptVNCDES (self, password, challenge)

Encrypts a password with the server's challenge to create the challenge response

Parameters

self
 
password
string containing the password to process
challenge
string containing the server challenge

Return value:

the challenge response string
getProtocolVersion (self, version)

Returns the protocol version reported by the server

Parameters

self
 
version
string containing the version number
getSecTypesAsTable (self)

Returns all supported security types as a table

Parameters

self
 

Return value:

table containing a entry for each security type
handshake (self)

Performs the VNC handshake and determines

  • The RFB Protocol to use
  • The supported authentication security types

Parameters

self
 

Return values:

  1. status, true on success, false on failure
  2. error string containing error message if status is false
login (self, username, password, authtype)

Attempts to login to the VNC service using any supported method

Parameters

self
 
username
string, could be anything when VNCAuth is used
password
string containing the password to use for authentication
authtype
The VNC auth type from the VNC.sectypes table (default: best available method)

Return values:

  1. status true on success, false on failure
  2. err string containing error message when status is false
login_vncauth (self, username, password)

Attempts to login to the VNC service using VNC Authentication

Parameters

self
 
username
string, could be anything when VNCAuth is used
password
string containing the password to use for authentication

Return values:

  1. status true on success, false on failure
  2. err string containing error message when status is false
supportsSecType (self, sectype)

Checks if the supplied security type is supported or not

Parameters

self
 
sectype
number containing the security type to check for

Return value:

status true if supported, false if not supported