使用 Python 的 P2P RDP
我想用 Python 编写一个简单的 P2P RDP 客户端和服务器。 这就是我绘制草图的方式。
- 在短时间内截取屏幕截图
- 压缩它们并将其发送到服务器应用程序
- 从服务器应用程序获取键盘、鼠标事件。将它们序列化并发送给客户端。客户端将反序列化它们,并使用 SendInput 调用来反映它们
,我需要知道的是
- Python 中是否存在可以用来简化工作的 rdp 库?
- 如何使用 Python 从服务器操作员获取键盘或鼠标事件?
- 事件序列化的最简单的方法是什么?
- 如何测量 Mouseevent 的相对 X,Y 坐标?
- 您能提供任何易于理解的示例吗?
- 我听说的最后一个问题是,如果两个平台都使用 Microsoft 衍生操作系统,那么在 .net 中执行此操作会更容易。是真的吗?
我的客户端应用程序将在 Windows XP、Vista、7 上运行,服务器应用程序将在 Windows/Linux 上运行 如果我遗漏了什么,也请提及。
I want to write a Simple P2P RDP Client and Server in Python.
This is how I Sketched it out.
- Take Screenshots in short Interval
- Compress them and send to the server application
- Get Keyboard, Mouse events from server application. Serialize them and send to client. Client will unserialize them and will use SendInput Calls to reflect them
and What I need to know is
- Do there exist and rdp library in Python that I can use to simplify my Job ?
- How to get Keyboard or Mouse Event from Server Operator with Python ?
- Whats the easiest and simplest way of serialization of events ?
- How can I measure the relative X,Y coordinates of Mouseevent ?
- can you provide any example thats easy to follow ?
- and the Final question I've heard it will be easier to do it in .net if both the platforms are using Microsoft derivative OS. Is it true ?
My Client Application will run in Windows XP,Vista,7 and the server Application will run on Windows/Linux
and also Please mention If I am missing something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
前段时间我写了一些名为 easyrfb 的东西,它也是基于 python-vnc-viewer,但我从未发布过它。它并没有完全涵盖您所要求的内容,但非常相似。希望它可能有所帮助,现在可以在 http://Hydra.geht.net/ 找到它的部分内容easyrfb/
请注意,那里的文件并不总是处于工作状态,因为这些文件直接链接到我的工作副本。但我不经常编辑。
现在它也可以在 GitHub 上使用: https://github.com/hilbix/pyrfb/tree/easyrfb
这就是它在我身边所做的事情:
内部通信是使用 TCP、Unix-Sockets 和一些文件完成的,因此更改它并不困难,每个组件都在不同的位置运行:
rfbimg.py (执行 VNC -> 图像并提供控制
.sock
)sendsock.py
与.sock 对话
)AJAX
和GET
图像)(将命令转发到.sock
)lynx
或telnet
都可以)请不要向我索要文档!使用源代码,Luke!
心理健康警告! 完整的图片是一大堆丑陋的、不干净的、令人头疼的、捂脸的东西,创建了一些大多不相关的随机放置的复杂脚本,这些脚本具有错误和误导性的名称、不干净的副本、未注释和未完成的一半-编辑,所有内容都硬编码到一台机器上,可能需要对未升级的软件包甚至更旧的东西进行一些未记录的本地 10 年旧调整。所以我不会交出所有的东西。 (即使这听起来很熟悉,但不,我不是在微软工作。)
Some time ago I wrote something called easyrfb which, too, is based on python-vnc-viewer, but I never published it. It does not cover exactly what you asked, but it is very similar. In the hope it might be helpful, parts of it now can be found at http://hydra.geht.net/easyrfb/
Note that the files there are not always in a working state, because the files are directly linked to my working copy. But I am not editing often.
It's now available on GitHub, too: https://github.com/hilbix/pyrfb/tree/easyrfb
This it what it does at my side:
The internal communication is done using TCP, Unix-Sockets and some files, so it's not difficult to change it such, that every component runs at a different location:
rfbimg.py
(which does VNC -> image and offers the control.sock
)sendsock.py
to talk to.sock
)AJAX
, andGET
image) with stubs (forwarding commands to.sock
)lynx
ortelnet
can do)Please do not ask me for documentation! Use the source, Luke!
Mental health warning! The complete picture is a big and ugly grown unclean pile of headache-inducing-facepalm creating bits of mostly unrelated randomly placed complex scripts with wrong and misleading names, unclean copies, uncommented and unfinished half-edits, everything hardcoded to exactly one single machine, probably needing some undocumented local 10 year old tweaks to nonupgraded packages, or even older stuff. So I will not hand out everything. (And even if this sounds familiar, nope, I am not working for Microsoft.)
除了“用Python”之外,听起来你只是在重新发明另一个VNC。大多数现代衍生品都基于 TightVNC,即 开源。如果您能理解 VNC 代码 (C++) 及其使用的 RFB 协议,您会发现你所有的问题都得到了解答。
您可能也会对 VNC 客户端的 Python 实现感兴趣。但是,请注意该页面上的评论:
也许您可以通过以某种方式重用 VNC 技术来实现您的目标? (例如,为 VNC C++ 代码创建 Python 绑定和/或使用 RFB 协议,以便可以与现有的 VNC 服务器/客户端进行互操作?)
Well apart from the "in Python", sounds like you're just reinventing another VNC. Most modern derivatives are based on TightVNC which is open source. If you can understand the VNC code (C++) and the RFB protocol it uses, you'll find all of your questions answered.
This python implementation of a VNC client might also be interesting to you. However, note the comment on that page:
Maybe you can achieve your goals by reusing VNC technology in some way ? (e.g creating Python bindings for the VNC C++ code and/or using the RFB protocol so you can interoperate with existing VNC servers/clients ?)
根据此 GitHub 评论,您可以使用
libfreerdp< /code> 通过 Python 中的
ctypes
。请参阅:GitHub 上的 FreeRDP 库。
As per this GitHub comment, you can use
libfreerdp
viactypes
in Python.See: FreeRDP library at GitHub.