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.
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?
Can anyone share a work-around to get the MAC addresses for iOS 10.2 devices on WiFi?
Where Can I Find a MAC Address on an iPhone? You can find the MAC address in two places, and both are within the settings app.
Starting with iOS 14, iPadOS 14, and watchOS 7, your device improves privacy by using a different MAC address for each Wi-Fi network. This unique MAC address is your device's private Wi-Fi address, which it uses for that network only.
View Your iPhone's MAC Address Start by launching Settings on your iPhone. Then tap the “General” option. In the “General” menu, tap “About” to view your phone's information. On the “About” page, next to “Wi-Fi Address,” your iPhone's MAC address is listed.
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]); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With