有没有办法获取远程用户的MAC地址?

ltbird 2004-11-07 04:32:10
有没有办法获取远端 ,即不在同一个局域网内的计算机的MAC地址?
...全文
252 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ltbird 2004-11-09
  • 打赏
  • 举报
回复

此方法基于用户所安装协议及系统,对某些客户端有效
但是不可靠啊,并非所有客户端都具有相同的特征
kingzai 2004-11-09
  • 打赏
  • 举报
回复
Winsock Programmer's FAQ
Example: How to Get the Ethernet MAC Address, SNMP Method

James Marsh writes:

In my search for an ironclad method of finding the MAC address of the ethernet card of a system, I attempted the NetBIOS method as described in the FAQ, but found this to be unacceptable as some of our customers reportedly didn't use [NetBIOS]. I passed over the RPC method, and found a solution in a page maintained by Stas Khirman and Raz Galili.... They describe a method of using the internal SNMP calls in Windows (NT, 95, and 2000 have worked for me) that are used by netstat and other windows utilities, but unfortunately provide no code example for finding the MAC code.

[Below is] a small program I've written up, so that hopefully other people won't have to go through the same learning curve I did with SNMP. I will also attach a file, snmpapi.cpp, that was written by Stas Khirman and distributed on his web page.

A great resource for those interested in retrieving system info through this method is http://www.alvestrand.no/objectid/top.html.
ltbird 2004-11-09
  • 打赏
  • 举报
回复
自定义协议估计是不可能实施的。
我是要在网络的监控端对所有的数据包获取原始MAC地址。

原始套接口所截取的包也没有含有原始MAC地址的信息。
vataii 2004-11-08
  • 打赏
  • 举报
回复
用原始套接口大概可以。他有如下功能

原始套接口

原始套接口提供一般套接口所不提供的功能:


原始套接口可以读写一些用于控制的控制协议分组,如ICMPv4等,进而可实现一些特殊功能。
原始套接口可以读写特殊的IPv4数据包。内核一般只处理几个特定协议字段的数据包,那么一些需要不同协议字段的数据包就需要通过原始套接口对其进行读写;
通过原始套接口可以构造自己的Ipv4头部,也是比较有意思的一点。

创建原始套接口需要root权限。

smaxll 2004-11-07
  • 打赏
  • 举报
回复
正常情况下是取不到的。
网络上的数据包的首部包含着俩个MAC地址,一个源MAC地址,一个目的MAC地址
网卡的MAC地址在经过路由器时候会被路由器的MAC地址取代
也就是说一个网络数据包中的MAC地址每经过一个路由器就会发生变化

能获取到的只有IP地址,路由器就是基于IP层工作的。
当然,如果你可以使用私有协议通讯的话,则可以自定义获取MAC

23,125

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧