MAC addresses in iOS 10.2(iOS 10.2 中的 MAC 地址)
问题描述
看起来从 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 地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS 10.2 中的 MAC 地址


基础教程推荐
- LocationClient 与 LocationManager 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01