显示多组MAC地址的错误请帮忙 [英] Show error for multiple set of MAC address please help

查看:199
本文介绍了显示多组MAC地址的错误请帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显示多组MAC地址的错误我在这里创建项目检查mac地址进程如果匹配则运行应用程序关闭应用程序



但是有些时间显示 061EA6B401C8 这个mac地址有一段时间 D0BF9C07C7EA

有些时候其他人请帮帮我我有个想法MAC地址已修复但现在改变了我的知识

i使用此功能:



我尝试过:



公共函数getMacAddress()
尝试
Dim adapters As NetworkInterface()= NetworkInterface.GetAllNetworkInterfaces()
Dim adapter As NetworkInterface
Dim myMac As String = String.Empty

For Each adapter in adapters
Select Case adapter.NetworkInterfaceType
'Exclude Tunnels,Loopbacks and PPP
Case NetworkInterfaceType.Tunnel,NetworkInterfaceType。 Loopback,NetworkInte rfaceType.Ppp
Case Else
如果不是adapter.GetPhysicalAddress.ToString = String.Empty而不是adapter.GetPhysicalAddress.ToString =00000000000000E0那么
myMac = adapter.GetPhysicalAddress.ToString
退出'有一个mac所以退出
结束如果

结束选择
下一个适配器

返回myMac
Catch ex As Exception
返回String.Empty
结束尝试

结束函数

解决方案

< blockquote>出于安全目的而使用MAC寻址不是一个好主意:它们不是唯一的,在特定的段上是唯一的,并且非常容易被欺骗。



另外,您没有获取该机器中网络适配器的MAC地址!请参阅此处:检索LAN的IP和MAC地址 [ ^ ] - 有一种方法可以获得当前的PC MAC(它在C#中,但它的代码非常明显)。



但它赢了作为安全措施很好用!


show error for multiple set of MAC address i create a project here check the mac address process if match then run application else close the application

but some time show 061EA6B401C8 this mac address some time D0BF9C07C7EA
some time others please help me i have a idea MAC address is fix but now change my knowledge
i use this function :

What I have tried:

Public Function getMacAddress()
       Try
           Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
           Dim adapter As NetworkInterface
           Dim myMac As String = String.Empty

           For Each adapter In adapters
               Select Case adapter.NetworkInterfaceType
                   'Exclude Tunnels, Loopbacks and PPP
                   Case NetworkInterfaceType.Tunnel, NetworkInterfaceType.Loopback, NetworkInterfaceType.Ppp
                   Case Else
                       If Not adapter.GetPhysicalAddress.ToString = String.Empty And Not adapter.GetPhysicalAddress.ToString = "00000000000000E0" Then
                           myMac = adapter.GetPhysicalAddress.ToString
                           Exit For ' Got a mac so exit for
                       End If

               End Select
           Next adapter

           Return myMac
       Catch ex As Exception
           Return String.Empty
       End Try

   End Function

解决方案

Using MAC addressed for security purposes is not a good idea: they aren't unique, just unique on a particular segment and are very easily spoofed.

Plus, you aren't fetching the MAC address for the network adapter in that machine! See here: Retrieving IP and MAC addresses for a LAN[^] - there is a method in there to get the current PC MAC (it's in C#, but it's pretty obvious code).

But it won't work well as a security measure!


这篇关于显示多组MAC地址的错误请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆