看起来从 iOS 10.2
开始,Apple 现已阻止访问所有 MAC 地址,而不仅仅是您自己的设备.
It looks like starting with iOS 10.2
, Apple has now prevented access to all MAC addresses, not just the one of your own device.
但是,商店中的一些应用似乎仍然可以管理,例如 Fing 和 Net Analyzer.这些仍然有效,因为它们是针对旧版 SDK 编译的,还是它们有收集 MAC 地址的特殊技巧?
However, there are some apps in the store that seem to manage that still, .e.g Fing and Net Analyzer. Are these still working because they were compiled against an older SDK or do they have special tricks to gather the MAC address?
谁能分享一个解决方法来获取 WiFi 上 iOS 10.2 设备的 MAC 地址?
Can anyone share a work-around to get the MAC addresses for iOS 10.2 devices on WiFi?
这只是测试代码,只是提供一个如何获取Mac地址的想法.但我相信苹果很快就会关闭这个选项.
This is only test code, just to give an idea for how to get the Mac address. But I am sure Apple will soon close this option.
-(void) jan_mac_addr_test:(const char*) host
{
#define BUFLEN (sizeof(struct rt_msghdr) + 512)
#define SEQ 9999
#define RTM_VERSION 5 // important, version 2 does not return a mac address!
#define RTM_GET 0x4 // Report Metrics
#define RTF_LLINFO 0x400 // generated by link layer (e.g. ARP)
#define RTF_IFSCOPE 0x1000000 // has valid interface scope
#define RTA_DST 0x1 // destination sockaddr present
int sockfd;
unsigned char buf[BUFLEN];
unsigned char buf2[BUFLEN];
ssize_t n;
struct rt_msghdr *rtm;
struct sockaddr_in *sin;
memset(buf,0,sizeof(buf));
memset(buf2,0,sizeof(buf2));
sockfd = socket(AF_ROUTE, SOCK_RAW, 0);
rtm = (struct rt_msghdr *) buf;
rtm->rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in);
rtm->rtm_version = RTM_VERSION;
rtm->rtm_type = RTM_GET;
rtm->rtm_addrs = RTA_DST;
rtm->rtm_flags = RTF_LLINFO;
rtm->rtm_pid = 1234;
rtm->rtm_seq = SEQ;
sin = (struct sockaddr_in *) (rtm + 1);
sin->sin_len = sizeof(struct sockaddr_in);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = inet_addr(host);
write(sockfd, rtm, rtm->rtm_msglen);
n = read(sockfd, buf2, BUFLEN);
if (n != 0) {
int index = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_inarp) + 8;
// savedata("test",buf2,n);
NSLog(@"IP %s :: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",host,buf2[index+0], buf2[index+1], buf2[index+2], buf2[index+3], buf2[index+4], buf2[index+5]);
}
}
这篇关于iOS 10.2 中的 MAC 地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!