ConsoleUser
Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com
This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.
All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.
- class rfbpy.PixelFormat(data=None)¶
Encapsulate all of the fields from the Pixel Format struct in an RFB message.
Paramters:
data: the packed struct as read from a socket from the server
- decode(raw)¶
Given some data encoded with this format, return the RGB values it represents
- rgb555_to_rgb222(pix)¶
Convert a pixel from one RGB encoding to another
If pix is iterable, an iterable will be returned with the transofmration applied to each.
- unpack_rgb555(pix)¶
Convert an RGB555 int to its 3 parts
- class rfbpy.RFBConnection(host=None, port=None, password=None)¶
An RFBConnection represents a persistent RFB connection to a specific remote server. It provides all the functionality to retreive the current view of the frame buffer and to send intput events to the server.
Parameters:
host: the address of the RFB server, defaults to 127.0.0.1
port: the port of the RFB server, defaults to 5900
password: optionally, the password to authenticate to the server
- connect()¶
Establish the connection to the remote server
- get_framebuffer()¶
Get a pristine copy of the framebuffer after getting any available updates.
- get_raw_framebuffer()¶
Get a pristine copy of the framebuffer after getting any available updates.
- key_event(key, pressed)¶
Send the event that a key was either pressed or released
- map_mouse(buttons, down)¶
Given a string describing which buttons are either being pressed or released.
The string should contain some set of “l,” “r,” or “m” which respectively mean “left,” “right,” and “middle” buttons.
Parameters:
buttons: a string listing the button(s) to press or release
- down: whether the buttons are being pressed down (True) or
released (False)
- pointer_event(button, x_pos, y_pos)¶
Send a mouse pointer event clicking the given button(s) at the given location.
Parameters:
button: an int mask of the state of all 8 buttons
x_pos: the x-position of this event
y_pos: the y-position of this event
- read_message(len_size=4)¶
Given that we can read len_size bytes to get the length of the incoming message, then read that many bytes, get the message and return it.
Parameters:
- len_size: the int number of bytes to read the will give the
length of the message to read
- request_framebuffer_update(wait=True)¶
Request any updates to the framebuffer
Parameters:
- wait: Wait until the server has responded to this update
request before returning
- rfbpy.byte_to_int(msg, big_end=True)¶
Given a string of hex bytes, return an int represented by them
- rfbpy.bytes_to_int(msg, big_end=True)¶
Given a list of strings of hex bytes, return a list of ints representing them
- rfbpy.map_key(keycode)¶
Decodes a key name into a scancode to allow for easier use of special keys. This function may be incomplete for non-english languages, as it only implements keys in the table on Page 23 of the RFB 3.8 specification. Most unicode keys should work fine as long as the target supports the keysym tables.
- rfbpy.null_auth(*args)¶
Stub to do “no authentication required”
- rfbpy.read_raw_pixels(sock, width, height, pix)¶
Read a rectangle of pixels from the given socket and return that as a numpy array