C# 如何从 MAC 或 IP 地址获取设备类型?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10700179/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 14:53:13  来源:igfitidea点击:

How to get device type from MAC or IP address?

c#ip-addressdevicemac-addresshostname

提问by Azeem Akram

I am making a Device Discovery windows application in C#. Is this possible to know the device type if I have MAC address or IP address?

我正在用 C# 制作一个设备发现 Windows 应用程序。如果我有 MAC 地址或 IP 地址,是否可以知道设备类型?

device type means either it is computer or router or mobile or any other device?

设备类型是指计算机或路由器或移动设备或任何其他设备?

Note: HostName entry is not useful for it because Host Name is defined by User. for example i may assign "Nokia N70" name to my computer.

注意:HostName 条目对它没有用,因为 Host Name 是由 User 定义的。例如,我可能会为我的计算机分配“诺基亚 N70”名称。

Thanks in anticipation.

感谢期待。

采纳答案by Nick

You can get the manufacturer from the MAC address. In order to get any more information you'd need to do a port scan to do a 'fingerprint' of the device in question.

您可以从 MAC 地址获取制造商。为了获得更多信息,您需要进行端口扫描以获取相关设备的“指纹”。

Application such as NMAPuse this approach.

NMAP等应用程序使用这种方法。

回答by Shai

IP Address: No. The Internet Protocol address can not help you figure out which device is being used

IP 地址:否。Internet 协议地址无法帮助您确定正在使用的设备

As for the MAC address: See thiswebsite.

至于 MAC 地址:请参阅网站。

Basicly, each vendor 'owns' a range of MAC addresses, this specific website can ever offer you the range used for each vendor. pretty neat.

基本上,每个供应商“拥有”一个 MAC 地址范围,这个特定的网站可以为您提供每个供应商使用的范围。漂亮整齐。

回答by Ed Kirk

Non-spoofed MAC addresses do include a manufacturers string at the start, but I don't know of any publicly available database that holds them. There is also no device mapping after this.

非欺骗性 MAC 地址在开头确实包含制造商字符串,但我不知道有任何公开可用的数据库包含它们。此后也没有设备映射。

The matter is even more complex when you add in the use of virtual machines, which require there own MAC address.

当您使用需要自己的 MAC 地址的虚拟机时,事情就变得更加复杂了。

IP addresses, no they are assigned by network administrators however they want, often virtually random.

IP 地址,不,它们由网络管理员随意分配,通常几乎是随机的。

So in short no.

所以简而言之没有。