citronneur / rdpy

Remote Desktop Protocol in Twisted Python
GNU General Public License v3.0
1.69k stars 546 forks source link

RDPY client/server test #30

Closed gaikwad7amar closed 9 years ago

gaikwad7amar commented 9 years ago

Hi, Thanks for your efforts in creating this library and sharing with us!

I am trying to use this code to handle some actions on a remote machine. I am able to connect to the remote machine using the rdpy client code sample, however, I am not able to send any mouse or key events to the remote machine. How do I achieve this?

Do I need to run the rdpy server code on the remote machine? if so, how can I do it since the port 3389 is already in use by the TCP services on windows and the rdpy server code throws exception saying that it cant listen on port 3389 since its already being listened by the windows TCP services.

Let me know...Thanks in advance!

gaikwad7amar commented 9 years ago

I am able to run the MyRDPFactory sample code on the remote machine and use the rdpy-rdpclient.py from my machine to connect to the remote machine. Seems like the connection establishes fine however, I do see only a blank black screen. The MyRDPFactory code does recognize the mouse events and the key events that I am doing from my machine but there is no way I can see whats happening on the remote machine since I only get the blank black screen. Can you help me out with this and guide as to how should I proceed?

citronneur commented 9 years ago

Hi,

No need to use the rdpy server side, just use the terminal server. Try to see edpy-rdpclient exemple and more precisely rdpy.ui.qt4.RDPClientQt class.

Feom MyRDPFactory exemple you can send control throw controller object. Exemple : mouse event : self._controller.sendPointerEvent(x, y, buttonNumber, isPressed) key event : self._controller.sendKeyEventUnicode(ord(unicode("r".toUtf8(), encoding="UTF-8")), True) to send r keyboard key. For more special keys use scancode events.

Best regards, Sylvain

citronneur commented 9 years ago

class MyObserver(rdp.RDPClientObserver)

        def onReady(self):
            """
            @summary: Call when stack is ready
            """
            #send 'r' key
            self._controller.sendKeyEventUnicode(ord(unicode("r".toUtf8(), encoding="UTF-8")), True)
            #mouse move and click at pixel 200x200
            self._controller.sendPointerEvent(200, 200, 1, true)

        def onUpdate(self, destLeft, destTop, destRight, destBottom, width, height, bitsPerPixel, isCompress, data):
            """
            @summary: Notify bitmap update
            @param destLeft: xmin position
            @param destTop: ymin position
            @param destRight: xmax position because RDP can send bitmap with padding
            @param destBottom: ymax position because RDP can send bitmap with padding
            @param width: width of bitmap
            @param height: height of bitmap
            @param bitsPerPixel: number of bit per pixel
            @param isCompress: use RLE compression
            @param data: bitmap data
            """

        def onClose(self):
            """
            @summary: Call when stack is close
            """
citronneur commented 9 years ago

Excuse me is under observer object.

gaikwad7amar commented 9 years ago

Thanks for the samples but I was already able to send these events. So if I want to use the rdpserver code, what more code do I need to add to get rid of the blank black screen that I get on the client side??

Also in your above example do we need to write some code in the onupdate method to render ???

Thanks.

citronneur commented 9 years ago

Ok just understand what you want. RDPY is not like terminal server, i just implement the protocol. All windows glue use in terminal server are not implement. The server doesn't send update. It's just the protocol not the software sorry. You need to implement your own connector to windows graphic.It's not trivial. If you just want to send order to server, you just need to implement a client side no?

gaikwad7amar commented 9 years ago

Ok...thanks for the clarification! I was assuming that the server component is more than just protocol and handles the graphics too.

citronneur commented 9 years ago

Sorry, i close issue.

Sylvain