开发者

Banning MAC address from accessing certain port - C++

开发者 https://www.devze.com 2023-01-11 16:24 出处:网络
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 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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消