Verwenden Sie Login und Passwort mit der RDPY RDP -Bibliothek
Posted: 25 Feb 2025, 22:34
Ich versuche, diese RDP -Bibliothek zu verwenden: https://github.com/citronneur/rdpy. Aber ich verstehe nicht, wie ich mit Port, Anmeldung und Passwort eine Verbindung zum Host herstellen kann. In diesem Code gibt es kein Login und Kennwort: < /p>
from rdpy.protocol.rdp import rdp
from twisted.internet import reactor
class MyRDPFactory(rdp.ClientFactory):
def clientConnectionLost(self, connector, reason):
reactor.stop()
def clientConnectionFailed(self, connector, reason):
reactor.stop()
def buildObserver(self, controller, addr):
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 onSessionReady(self):
"""
@summary: Windows session is ready
"""
def onClose(self):
"""
@summary: Call when stack is close
"""
return MyObserver(controller)
reactor.connectTCP(ip, port, MyRDPFactory())
reactor.run()
< /code>
Vielleicht muss ich Anmeldung und Kennwort in Anmeldeformular eingeben, wenn ich bereits mit Host verbunden bin? Wie kann ich das machen?
from rdpy.protocol.rdp import rdp
from twisted.internet import reactor
class MyRDPFactory(rdp.ClientFactory):
def clientConnectionLost(self, connector, reason):
reactor.stop()
def clientConnectionFailed(self, connector, reason):
reactor.stop()
def buildObserver(self, controller, addr):
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 onSessionReady(self):
"""
@summary: Windows session is ready
"""
def onClose(self):
"""
@summary: Call when stack is close
"""
return MyObserver(controller)
reactor.connectTCP(ip, port, MyRDPFactory())
reactor.run()
< /code>
Vielleicht muss ich Anmeldung und Kennwort in Anmeldeformular eingeben, wenn ich bereits mit Host verbunden bin? Wie kann ich das machen?