简体   繁体   English

VirtualBox-如何编写驱动程序/插件?

[英]VirtualBox - How to write Drivers/Plugins?

I want to write my own virtual network card driver/plugin that can be configured for virtual machines within VirtualBox to intercept the incomming and outgoing packets. 我想编写自己的虚拟网卡驱动程序/插件,可以对VirtualBox中的虚拟机进行配置,以拦截传入和传出的数据包。
I found the documentation of VirtualBox's SDK at http://download.virtualbox.org/virtualbox/SDKRef.pdf but unfortunately it only describes how to use the remote API to control a VM but not how to write custom drivers or plugins for the VM itself. 我在http://download.virtualbox.org/virtualbox/SDKRef.pdf上找到了VirtualBox SDK的文档,但不幸的是,它仅描述了如何使用远程API来控制VM,但没有描述如何为VM编写自定义驱动程序或插件。本身。

Do you know of any documentation or tutorials to this topic? 您知道该主题的任何文档或教程吗?
Any pointers are highly apreciated. 任何指针都高度重视。

Update: 更新:
I've browsed in VirtualBox's sources and found the following: https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp 我浏览了VirtualBox的源代码,发现以下内容: https : //www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
Is there no documented interface for writing such functionality in a pluggable way? 是否没有用于以可插入方式编写此类功能的文档化接口?

The network handling in a VMM ("Virtual Machine Monitor" or "Hypervisor") is typically done by a simple interface that "pretends" to be a network card towards the VM and that is a bridge or switch type interface towards the host's network connection. VMM(“虚拟机监视器”或“管理程序”)中的网络处理通常由一个简单的接口完成,该接口“假装”为通往VM的网卡,并且是通往主机网络连接的网桥或交换机类型的接口。

I suspect you will not be able to easily attach to that, and almost certain that there is no "SDK" interface to it - I haven't worked with VirtualBox, but I have worked on Xen Hypervisor (which is open source, but even then, there's no easy interface to intercept packets in a meaningful way). 我怀疑您将无法轻松地附加到它,并且几乎可以肯定它没有“ SDK”接口-我没有使用VirtualBox,但是我使用的是Xen Hypervisor(这是开源的,但是那么,就没有一个易于使用的界面以有意义的方式拦截数据包)。

Your best bet is probably to implement this on the host's side of the bridge or switch interface that the VMM provides. 最好的选择可能是在VMM提供的网桥或交换机接口的主机侧实现此功能。 Most OS's have ways to hook into a network flow on the native side for firewall purposes. 大多数操作系统都可以通过多种方式插入本机网络上的网络流以用于防火墙。

(I'm still waiting for the SDK document to download - I think the server must be connected to the internet with a piece of wet string, as I've received 40KB since I started writing this post) (我仍在等待SDK文档的下载-我认为服务器必须使用一条湿线连接到Internet,因为自从我开始写这篇文章以来,我已经收到40KB的数据)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM