Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 服务器MAC地址和混淆_Vb.net_Obfuscation_Server_Mac Address - Fatal编程技术网

Vb.net 服务器MAC地址和混淆

Vb.net 服务器MAC地址和混淆,vb.net,obfuscation,server,mac-address,Vb.net,Obfuscation,Server,Mac Address,我正在开发一个VB.net windows窗体应用程序。我的应用程序连接到网络上指定名称的计算机,获取其MAC地址并执行检查,以防止“外出”使用该应用程序 主页加载事件如下所示: Private Declare Function inet_addr Lib "wsock32.dll" (ByVal s As String) As Integer Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIP As Intege

我正在开发一个VB.net windows窗体应用程序。我的应用程序连接到网络上指定名称的计算机,获取其MAC地址并执行检查,以防止“外出”使用该应用程序

主页加载事件如下所示:

Private Declare Function inet_addr Lib "wsock32.dll" (ByVal s As String) As Integer

Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIP As Integer, ByVal SrcIP As Integer, ByRef pMACAddr As Integer, ByRef PhyAddrLen As Integer) As Integer

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef dst As Byte, ByRef src As Integer, ByVal bcount As Integer)

Private Sub Mainpage_Load(sender As Object, e As EventArgs) Handles MyBase.Load



    Dim ServerName = "Office-NAS"
    Dim IpCollection As New Collection
    Try
        Dim ipE As Net.IPHostEntry = System.Net.Dns.GetHostEntry(ServerName)
        Dim IpA() As Net.IPAddress = ipE.AddressList
        For i = 0 To IpA.GetUpperBound(0)
            IpCollection.Add(IpA(i).ToString)
        Next
    Catch

        MessageBox.Show("Not connected to server - exiting")
        Me.Close()

    End Try

    Dim sip As String = IpCollection(1)
    Dim inet As Integer
    Dim b(6) As Byte
    Dim pMACAddr As Integer
    Dim j As Short
    Dim sResult As String = ""


    inet = inet_addr(sip)
    If SendARP(inet, 0, pMACAddr, 6) = 0 Then
        CopyMemory(b(0), pMACAddr, 6)
        For j = 0 To 5
            sResult = sResult & Microsoft.VisualBasic.Right("0" & Hex(b(j)), 2)
            If j < 5 Then sResult &= "-"
        Next
    End If



    MessageBox.Show(sResult) '' The server's MAC address


    Dim MACToBeChecked As String = "00-11-32-2E-93-76"

    Stop
    If sResult <> MACToBeChecked Then
        MessageBox.Show("Not in office- Exiting")
        Me.Close()
    End If


'Some other stuff


End Sub
Private将函数inet_addr Lib“wsock32.dll”(ByVal s作为字符串)声明为整数
私有函数SendARP Lib“iphlpapi.dll”(ByVal DestIP为整数,ByVal SrcIP为整数,ByRef pMACAddr为整数,ByRef PhyAddrLen为整数)声明为整数
私有声明子CopyMemory Lib“kernel32”别名“rtlmovemory”(ByRef dst作为字节,ByRef src作为整数,ByVal bcount作为整数)
私有子主页加载(发送方作为对象,e作为事件参数)处理MyBase.Load
Dim ServerName=“Office NAS”
Dim IpCollection作为新集合
尝试
Dim ipE As Net.IPHostEntry=System.Net.Dns.GetHostEntry(服务器名)
Dim IpA()作为Net.IPAddress=ipE.AddressList
对于i=0到IpA.GetUpperBound(0)
IpCollection.Add(IpA(i).ToString)
下一个
抓住
MessageBox.Show(“未连接到服务器-正在退出”)
我
结束尝试
Dim sip As String=IpCollection(1)
作为整数的Dim inet
尺寸b(6)作为字节
Dim pMACAddr作为整数
把j调短
Dim sResult As String=“”
inet=inet\u地址(sip)
如果SendARP(inet,0,pMACAddr,6)=0,则
CopyMemory(b(0),pMACAddr,6)
对于j=0到5
sResult=sResult&Microsoft.VisualBasic.Right(“0”和十六进制(b(j)),2)
如果j<5,则sResult&=“-”
下一个
如果结束
MessageBox.Show(sResult)“”服务器的MAC地址
Dim MACToBeChecked为String=“00-11-32-2E-93-76”
停止
如果sResult MACToBeChecked那么
MessageBox.Show(“不在办公室-正在退出”)
我
如果结束
“还有别的吗
端接头
我没有写获取IP地址和MAC地址的部分,我在网上找到了它们。它们工作得非常好

现在,我还想使用模糊器使我的代码更难反编译。我正在使用eazfouscator.NET。它工作得很好,但是当我使用它时,上面的代码不起作用。我意识到当模糊处理开启时,服务器MAC地址无法正确获取。实际上,前4对字符是正确的,但最后2对是错误的!!所以我不能正确地执行检查


我对这个问题感到非常困惑和困惑。如果您能提供任何帮助,我将不胜感激。

哪些字符不正确?他们打错号码了吗?信?其他与此无关的随机字符(来自不同的编码等)?它们是规则的数字和字母,就像我得到了一个错误的MAC地址。