禁止MAC地址访问特定端口 - C++

发布于 2024-09-14 23:08:25 字数 151 浏览 1 评论 0原文

我想阻止具有特定 MAC 地址的人访问我的服务器上的特定端口,我将其用作我的朋友运行的私人服务器的一种硬件禁令。

我希望在 C++ 中做到这一点,并且想知道我需要研究什么才能做到这一点。服务器运行Windows。

另外,我如何找到访问者的MAC地址?谢谢。

I want to stop someone with a certain MAC address from accessing a certain port on my server, I'm using this as a sort of hardware ban for a private server a friend of mine runs.

I am looking to do this in C++, and would like to know what I would need to research in order to do it. The server runs Windows.

Also, how would I find out the MAC address of the person accessing? Thankyou.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

黑白记忆 2024-09-21 23:08:25

仅当服务器和客户端位于同一 LAN 上时,MAC 地址过滤才有用。
服务器将看到最近的上游路由器的 MAC 地址,而不是客户端的 MAC 地址
MAC 地址。

Filtering on MAC addresses is only useful if the server and client are on the same LAN.
The server will see the MAC address of the nearest upstream router, not the client's
MAC address.

苏璃陌 2024-09-21 23:08:25

应用程序级套接字不允许进行 MAC 过滤。获取 MAC 的唯一方法是直接访问 TCP/IP 标头本身,而套接字不提供对此的访问。除非您使用低级拦截驱动程序(例如 WinPCap),否则您最好将服务器放在真正的硬件防火墙/路由器后面,并让它为您执行 MAC 过滤。

Application-level sockets do not allow for MAC filtering. The only way to get the MAC is to have direct access to the TCP/IP headers themselves, which sockets do not provide access to. Unless you use a low-level intercept driver, like WinPCap, then you are just better off putting the server behind a real hardware firewall/router and let it do the MAC filtering for you.

盛夏已如深秋| 2024-09-21 23:08:25

虽然我无法回答你的问题,但 MAC 地址现在往往是在软件中设置的,因此可以很容易地更改。

While I can't answer your question, MAC addresses now tend to be set in software, so can be changed pretty easily.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文