Programmatically manipulating active RDP session

天大地大妈咪最大 提交于 2020-01-25 03:43:16

问题


I've got Mac OSX running and want to programmatically manipulate a active RDP session to for instance, perform actions within a launched program within the session (dynamics specifically, yet woudn't hurt to know a universal way).

I don't know if this is possible. Currently using a RDP file to launch the RDP session with credentials and have the process ID of my active session, retrieved via NSWorkspace. With that I can do the basic stuff like closing my session again, yet i want to manipulate the session.

My RDP client currently is Microsoft Remote Desktop.

Would wish to reach my goal in either bash or python.


回答1:


Here are few ideas:

  • Use Quartz graphics library in Python to manipulate with RDP client window. Here is a good start: How to list all windows from all workspaces in Python on Mac?
  • Use libfreerdp via ctypes.
  • Run RDP session under Wine and use tools such as AutoHotKey, AutoIT or xdottool. See: How to programmatically control X11 forwarded apps?
  • Use WinRM (pywinrm) instead of RDP to run remote commands/scripts. Check this example. This can allow to run auto tools mentioned above (e.g. AHK script controlling the apps).
  • Use Python GUI automation library for simulating user interaction in apps.
  • See also: GUI scipting for Linux.
  • Write an RDP client that dumps the pixels of the screen. E.g. WebRTC or using libFreeRDP.
  • If RDP client runs via X11 protocol (Quartz), you can try to tap into X11 requests as per this post.
  • Use FreeRDP and its API. Its client is compatible with Linux, macOS and Windows.


来源:https://stackoverflow.com/questions/34630826/programmatically-manipulating-active-rdp-session

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!