Get Model Identifier of Device in Network

I have a couple of Apple devices in my network (both computers and mobile devices). I was wondering if it is possible, to get the model identifier like Macmini9,1 if I have the IP address and/or the Mac address.

I am using the NetServiceBrowser and NetService classes to find the devices. If the device has the AirPlay service, I can get the model identifier.

However, not all of my devices seem to implement/publish this service. Is there a more general approach?

macOS seems to know this information. In the Finder a specific icon is shown, so I guess the model identifier must be published somehow.

Answered by DTS Engineer in 747507022

macOS seems to know this information.

Right. macOS publishes a TXT record with this info and knows how to search for it. The exact details are not documented as API [1] but have been reverse engineered many times.

IMPORTANT If you decide to rely on it, keep in mind that it could change, or even go away, without notice. Such is the nature of relying on implementation details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Although I’m glad to see that the service type it uses is officially registered.

https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=device-info

Accepted Answer

macOS seems to know this information.

Right. macOS publishes a TXT record with this info and knows how to search for it. The exact details are not documented as API [1] but have been reverse engineered many times.

IMPORTANT If you decide to rely on it, keep in mind that it could change, or even go away, without notice. Such is the nature of relying on implementation details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Although I’m glad to see that the service type it uses is officially registered.

https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=device-info

Hello,

thank you for your information. I have tried searching for any devices that publish this information, but I do not get any results.

I assumed that the service is _device-info._tcp. I have added the Bonjour Services key to my Info.plist.

I also tried searching for this service using the Terminal using this command:

dns-sd -B _device-info._tcp

Nothing is shown on my Terminal (dns-sd -B _ssh._tcp lists a couple of items, so the syntax seems to be correct).

I also tried using the IP address: dns-sd -B _device-info._tcp 192.168.178.101

I tried "asking" the host directly:

let service = NetService(domain: "local.", type: "_device-info._tcp", name: "Mac-Mini.fritz.box")
service.delegate = self
service.startMonitoring()

No results though.

This also does not give any results. As you mentioned, there is no public API so I guess I can not get any detailed information. But am I at least on the right track? 😀

I’m sorry but the nature of unsupported things is that I can’t offer support on them.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hello,

thanks anyways. It is working now. It was a very small error (wrong format of the name).

Regards, Sascha

Get Model Identifier of Device in Network
 
 
Q