GithubHelp home page GithubHelp logo

pyvnc's Introduction

pyVNC

pyVNC Client is a client library for interacting programatically (and physically) with a VNC session. pyVNC Client that is built with Twisted-Python and PyGame.

The client supports the following encodings: Hextile, CoRRE, RRE, RAW, CopyRect

pyVNC is tested for Python >= 3.5

#Usage

Example 1

 vnc = VNCClient(host="127.0.0.1",
                 password=None, 
                 port=5902,
                 depth=32,
                 fast=False,
                 shared=True) # Default parameters
                 
 vnc.start()    # Starts the vnc client (Threaded)
 
 vnc.send_key("a") # Sends the key "a"
 vnc.send_mouse("Left", (200, 200)) # Left Clicks at x=200, y=200
 vnc.send_mouse("Right", (200, 200)) # Right Clicks at x=200, y=200
 vnc.get_screen() # Get a array representation of the screen shape: (?, ?, 3)
 vnc.join() # Exit

Parameters

pyVNC.py --host=127.0.0.1 --password=None --depth=32 --fast=False, shared=False

What is it good for?

pyVNC is excellent for automating tasks inside a VNC session.

References:

Copyright Notice

Thanks to the original authors for providing an excellent implemenation of the VNC protocol in python. This project would not have been possible with their work:

And pyVNC author:

Released under the MIT License.

You're free to use it for commercial and noncommercial application, modify and redistribute it as long as the copyright notices are intact. There are no warranties, not even that it does what it says to do ;-)

Changes

16.08.17 - Forked and reworked as a client library

pyvnc's People

Contributors

filipeabperes avatar perara avatar techtonik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyvnc's Issues

AttributeError: 'NoneType' object has no attribute 'pointer_event'

Traceback (most recent call last):
  File "/vnc.py", line 12, in <module>
    vnc.send_mouse()  # Left Clicks at x=200, y=200
  File "/Users/d/env/sgs/lib/python3.6/site-packages/pyVNC-0.1-py3.6.egg/pyVNC/Client.py", line 68, in send_mouse
AttributeError: 'NoneType' object has no attribute 'pointer_event'
Exception ignored in: <module 'threading' from '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 1294, in _shutdown
    t.join()
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 1056, in join
    self._wait_for_tstate_lock()
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

unsupported operand type(s) for &: 'str' and 'int'

Hi!
I've tried to run example from the README file, but it fails with the following:

  File "../lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "../lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "../lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "../lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "../lib/python3.6/site-packages/twisted/internet/selectreactor.py", line 149, in _doReadOrWrite
    why = getattr(selectable, method)()
  File "../lib/python3.6/site-packages/twisted/internet/tcp.py", line 243, in doRead
    return self._dataReceived(data)
  File "../lib/python3.6/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "../recognition/pyVNC/rfb.py", line 494, in dataReceived
    self._handler()
  File "../recognition/pyVNC/rfb.py", line 504, in _handle_expected
    self._expected_handler(block, *self._expected_args, **self._expected_kwargs)
  File "../recognition/pyVNC/rfb.py", line 163, in _handle_vnc_auth
    self.vnc_request_password()
  File "../recognition/pyVNC/RFBToGUI.py", line 45, in vnc_request_password
    self.send_password(self.factory.password)
  File "../recognition/pyVNC/rfb.py", line 169, in send_password
    des = RFBDes(pw)
  File "../recognition/pyVNC/pyDes.py", line 410, in __init__
    self.setKey(key)
  File "../recognition/pyVNC/rfb.py", line 649, in setKey
    super(RFBDes, self).setKey(newkey)
  File "../recognition/pyVNC/pyDes.py", line 415, in setKey
    self.__create_sub_keys()
  File "../recognition/pyVNC/pyDes.py", line 463, in __create_sub_keys
    key = self.__permutate(des.__pc1, self.__String_to_BitList(self.getKey()))
  File "../recognition/pyVNC/pyDes.py", line 429, in __String_to_BitList
    if ch & (1 << i) != 0:
builtins.TypeError: unsupported operand type(s) for &: 'str' and 'int'```

Are you going to support the library furthermore?

how to implements get_screen()

I couldn't find the implementation of the 'get_screen' method described in the example in the readme file in the Client.py file. Do I need to implement this code myself? And if so, how should I do it?"

Virus

Windows Defender saying that there is a HackTool:SH/PythonKeylogger.B
Is it false positive or not?

Client.screen.protocol is None

from pygame.locals import K_KP_ENTER
from pyVNC.Client import Client


vnc = Client(host='211.93.21.225', port=5900)
vnc.start()
vnc.send_key(K_KP_ENTER)
vnc.join()
pygame 2.5.0 (SDL 2.28.0, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\VNCGrubber\VNCGrubber\test.py", line 7, in <module>
    vnc.send_key(K_KP_ENTER)
  File "C:\Users\User\PycharmProjects\VNCGrubber\VNCGrubber\pyVNC\Client.py", line 36, in send_key
    self.screen.protocol.key_event(constants.KEYMAPPINGS[key], down=1)
AttributeError: 'NoneType' object has no attribute 'key_event'

python==3.8.10
pyVNC==0.1
pygame==2.5.0
Twisted==22.10.0
numpy==1.24.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.