0
我使用这个方法来获取MAC地址:C#防止MAC欺骗
public static string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
//for each j you can get the MAC
PhysicalAddress address = nics[0].GetPhysicalAddress();
byte[] bytes = address.GetAddressBytes();
string macAddress = "";
for (int i = 0; i < bytes.Length; i++)
{
macAddress += bytes[i].ToString("X2");
if (i != bytes.Length - 1)
{
macAddress += "-";
}
}
return macAddress;
}
,我保存的第一个结果,然后我一直在调用这个方法的时候每一个量,并比较其到第一个看看它是否被改变,从而导致其被欺骗。
但是,如果MAC地址已被欺骗,这将不起作用。
即使被欺骗,我如何获得原始的mac地址?
简答:你不能。看到[这个问题](https://stackoverflow.com/questions/9546228/how-to-detect-the-original-mac-address-after-it-has-been-spoofed)替代唯一标识设备。 – Rob