Results 1 to 38 of 38

Thread: [RESOLVED] Anti Spoofing MAC Address Change

  1. #1

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Resolved [RESOLVED] Anti Spoofing MAC Address Change

    My program's security basically depends on the host PC's MAC Address. Since there are a couple of utilities that can change MAC Address of a Network Card. My question is, under VB 6, is there any way to ....

    1. Get the original MAC Address (no matter which address has been configured)
    2. Or, Forcefully restore the original MAC Address of the NIC.

    Thankxs.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Anti Spoofing MAC Address Change

    As far as I know, the answer is no to both.

  3. #3

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    I have tested a utility "Amac MAC Address Changer". With this utility you can change the MAC Address of NIC Card, and later you can reset the MAC Address to its original state.

    If MAC Address can be changed and reset by a utility, WHY not VB6 ?
    Last edited by nepalbinod; Dec 29th, 2007 at 08:55 AM.

  4. #4

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Anti Spoofing MAC Address Change

    Quote Originally Posted by nepalbinod
    I have tested a utility "Amac MAC Address Changer". With this utility you can change the MAC Address of NIC Card, and later you can reset the MAC Address to its original state.

    If MAC Address can be changed and reset by a utility, when not VB6 ?
    Ok....I didn't know you could do that, but, at any rate, I strongly suspect this utility was not written in VB6, but probably something like C++

  6. #6
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Anti Spoofing MAC Address Change

    Oops !!!
    I think I gave you how to change it, not how to restore it.
    Sorry!
    My Bad.

    IIF(Post.Rate > 0 , , )

  7. #7

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change


    Yes, zeezee. I have been searching for some time. I've already been to these sites. My question, again, is if MAC Address can be changed and reset from a utility, why not from VB 6?

    Hack says the answer is no to both questions, but what I feel is there must be a way that MAC Address change can be retained.

  8. #8
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Anti Spoofing MAC Address Change

    Ok look at these

    http://www.klcconsulting.net/Change_MAC_w2k.htm
    http://tmac.technitium.com/tmac/index.html

    in 1st one
    Quote Originally Posted by SMAC
    *

    SMAC took advantage of the NdisReadNetworkAddress function in the Microsoft Device Driver Development Kit (DDK.)
    *

    NdisReadNetworkAddress(...) is called by the network adapter driver to obtain a user specified MAC address in the registry. After the driver confirms that there's a valid MAC address specified in the registry key, the driver then programs the MAC address to its hardware registers to override the burn-in MAC address.
    2nd one

    Quote Originally Posted by Technitium

    This software just writes an value into the windows registry. When the Network Adapter Device is enabled, windows searches for the registry value 'NetworkAddress' in the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1- 08002bE10318}\[ID of NIC e.g. 0001]. If a value is present, windows will use it as MAC address, if not, windows will use the hard coded manufacturer provided MAC address. Simple? Some Network Adapter drivers have this facility built-in. It can be found in the Advance settings tab in the Network Adapter's Device properties in Windows Device Manager.
    Quote Originally Posted by Technitium
    4. To restore the original MAC address of the network adapter, select the adapter, click Change MAC button and then click Original MAC button and confirm changes you made when prompted.

    NOTE: This tool cannot change MAC address of Microsoft Network Bridge. Network Bridge will automatically use the original MAC address of the first NIC added into bridge with the first octet of MAC address set to 0x02.

    so the answer to your qestion lies there.
    May be you could contact those developers and get some help. (If they are willing)

    Sure you can do it in VB. Its only a registry hack. make an app to search for those values and resotre it.
    But changing original Hardware MAC is beyond my knowledge. May be a Flash burner or some radio shack gadget would do.

    IIF(Post.Rate > 0 , , )

  9. #9

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    Hello Folks,

    I have been through this for the whole day. My conclusion here is :

    1. By default, the MAC Address of a LAN Card is not saved on registry.
    2. When a user changes the MAC Address of a NIC with a utility, it is not actually changed. The MAC Address remains same forever, only the registry contains an additional entry "NetworkAddress" in

    "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
    Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\"
    under the respective key of ethernet control

    e.g.

    Code:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
    Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0000
    If I had come to the conclusion very fast or impatiently, it is :

    Delete the String Value "NetworkAddress" for each Network Control Class. The changed MAC Address will be reset to the original one.
    Could you show me VB Function that upon call, deletes the above entries in the registry.

    Thankx.
    Last edited by nepalbinod; Dec 29th, 2007 at 10:35 AM. Reason: Grammar check

  10. #10
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Anti Spoofing MAC Address Change

    There are dozens upon dozens of registry editors on forums like this one, and sites like PSCcode. You can easily use them and tweak your own registry. Keep in mind that on newer systems, anyone running your app without higher privileges probably won't be able to modify the registry.

  11. #11

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    Yes zeezee.

    Now on the next step ...

    I want a way to force the registration to "demo version only" if there is not "actual ethernet controller" present on the system.

    Since, anyone could use "Microsoft Loopback Adapter" which has "02-00-4C-4F-4F-50" MAC Address and register the program with the same serial number on multiple systems.

    What is the range of MAC Address that is alloted to NIC manufacturers ?
    What is the range of MAC Address that have been reserved for "Virtual Network Devides" such as "Microsoft Loopback Adapter".

  12. #12
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Anti Spoofing MAC Address Change

    See whether this would help you

    http://standards.ieee.org/regauth/oui/oui.txt

    But I wouldnt think that there is REALLY a way to avoid this.

    You know hackers will always hack. SO they will find a way around this also.

    Another thing is to get the real Hardware MAC. This wouldnt be easy. But sure their would be a way to that.

    I still wonder whether ther is actually way to stop piracy.

    But , wish you luck.

    IIF(Post.Rate > 0 , , )

  13. #13
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Anti Spoofing MAC Address Change

    Quote Originally Posted by zeezee
    I still wonder whether ther is actually way to stop piracy.
    Yes, there is a way. It is invented nearly every day.

    Then, the day after, someone comes up with a way to get around the new way to prevent it.

    If your question was "I still wonder whether ther is actually way to stop piracy permanately...then I would No.

  14. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Anti Spoofing MAC Address Change

    It doesnt matter if the user has MAC cloning software or Hack it somehow. The real solution will be in the way your obtain the MAC address. If you use WMI then it should be obtaining it from the network card and not the registry.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  15. #15
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Anti Spoofing MAC Address Change

    @ Hack
    Sometimes wonder isnt it good if everything was free. Then no hackers right?
    Then again , how would I feed my self If I cant make money
    So its going to be a never ending fight between Pirates and Traders.
    (A Good plot for next Pirates of the Caribbean????)

    @ RobDog888

    Yeah you gave one good point.

    IIF(Post.Rate > 0 , , )

  16. #16

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    Quote Originally Posted by RobDog888
    It doesnt matter if the user has MAC cloning software or Hack it somehow. The real solution will be in the way your obtain the MAC address. If you use WMI then it should be obtaining it from the network card and not the registry.
    Would you tell me how to obtain MAC Addres using WMI.

    Still Unanswered Questions:
    What is the range of MAC Address that is alloted to NIC manufacturers ?
    What is the range of MAC Address that have been reserved for "Virtual Network Devides" such as "Microsoft Loopback Adapter"?

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Anti Spoofing MAC Address Change

    Download Scriptomatic v2 from Microsoft and it will generate the script to execute the WMI code. Then just convert to VB.
    Code:
    On Error Resume Next
    
    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20
    
    arrComputers = Array(".")
    For Each strComputer In arrComputers
       WScript.Echo
       WScript.Echo "=========================================="
       WScript.Echo "Computer: " & strComputer
       WScript.Echo "=========================================="
    
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)
    
       For Each objItem In colItems
          WScript.Echo "AdapterType: " & objItem.AdapterType
          WScript.Echo "AdapterTypeId: " & objItem.AdapterTypeId
          WScript.Echo "AutoSense: " & objItem.AutoSense
          WScript.Echo "Availability: " & objItem.Availability
          WScript.Echo "Caption: " & objItem.Caption
          WScript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
          WScript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
          WScript.Echo "CreationClassName: " & objItem.CreationClassName
          WScript.Echo "Description: " & objItem.Description
          WScript.Echo "DeviceID: " & objItem.DeviceID
          WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
          WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
          WScript.Echo "Index: " & objItem.Index
          WScript.Echo "Installed: " & objItem.Installed
          WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
          WScript.Echo "MACAddress: " & objItem.MACAddress
          WScript.Echo "Manufacturer: " & objItem.Manufacturer
          WScript.Echo "MaxNumberControlled: " & objItem.MaxNumberControlled
          WScript.Echo "MaxSpeed: " & objItem.MaxSpeed
          WScript.Echo "Name: " & objItem.Name
          WScript.Echo "NetConnectionID: " & objItem.NetConnectionID
          WScript.Echo "NetConnectionStatus: " & objItem.NetConnectionStatus
          strNetworkAddresses = Join(objItem.NetworkAddresses, ",")
             WScript.Echo "NetworkAddresses: " & strNetworkAddresses
          WScript.Echo "PermanentAddress: " & objItem.PermanentAddress
          WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
          strPowerManagementCapabilities = Join(objItem.PowerManagementCapabilities, ",")
             WScript.Echo "PowerManagementCapabilities: " & strPowerManagementCapabilities
          WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
          WScript.Echo "ProductName: " & objItem.ProductName
          WScript.Echo "ServiceName: " & objItem.ServiceName
          WScript.Echo "Speed: " & objItem.Speed
          WScript.Echo "Status: " & objItem.Status
          WScript.Echo "StatusInfo: " & objItem.StatusInfo
          WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
          WScript.Echo "SystemName: " & objItem.SystemName
          WScript.Echo
       Next
    Next
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    Thankx RobDog888,

    This was a bit hard to implement on VB6. I couldn't play around with 'WScript'.

    In my case (please note)
    Just don't need to access the WMI Service through network. The program is intended to check the MAC Address of the computer on which it is running.

    I will try the 'Scriptomatic v2' thing asap.

    Thankx for the your great concept, but the problem is not solved till now if I mean it do your way (and I think that's the best way).

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Anti Spoofing MAC Address Change

    Well it is easy to convert. Just change all variables to either string or Object as needed so you can maintain the Option Explicit good coding standards. then switch Echos to MsgBox or write to a string variable.

    But most important is that it shows the properties available to you which is hard to figure out any other way.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Anti Spoofing MAC Address Change

    What is the range of MAC Address that is alloted to NIC manufacturers ?
    http://standards.ieee.org/regauth/oui/oui.txt

    This is it I think.

    BTW, what ever the method we obtain MAC, WMI or Registry, isnt it the driver that provides it?

    @nepalbinod
    Just a question, cant you use any other method for this demo version thing?
    Like MB Serial + Hard Drive Serial ?

    Or GUID / UUID?

    IIF(Post.Rate > 0 , , )

  21. #21

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    Of course, zeezee !

    But this method has already been implemented and now if I am able to obtain the original MAC Address (I will finally do it!), it would be very hard to crack the program unless a keygen is developed.

    Hi RobDog888,

    I tested as you said, I changed (spoofed) the original MAC Address to 0A-0A-0A-0A-EA-EA. Now when I check using WMI, it returns the spoofed MAC Address (not the original one). Here's the code:

    Code:
    '---------------------------------------------------
    'Begin
    
    strComputer = "."
    strTargetAddress = "173.16.10.13" 'Change the IP Address to Network Card's IP Address
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery _
        ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    
    For Each objItem In colItems
        arrIPAddresses = objItem.IPAddress
        For Each strAddress In arrIPAddresses
            If strAddress = strTargetAddress Then
                strMACAddress = objItem.MacAddress
      
            End If
        Next
    Next
    
    MsgBox strMACAddress
    
    'End
    '---------------------------------------------------
    It does not work as you said RobDog888!
    Last edited by nepalbinod; Jan 1st, 2008 at 02:51 AM.

  22. #22
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Anti Spoofing MAC Address Change

    there is also an api, getadaptorsinfo which will return the mac address, but without testing how to tell if it is the real one or a spoof

    from allapi you can cut out all the stuff you don't need
    vb Code:
    1. 'Paste this code into a module and set the Startup Object
    2. 'to 'Sub Main'
    3. '(To set the startup object, go to
    4. 'Project->Project Properties->General Tab->Startup Object)
    5.  
    6. Public Const MAX_HOSTNAME_LEN = 132
    7. Public Const MAX_DOMAIN_NAME_LEN = 132
    8. Public Const MAX_SCOPE_ID_LEN = 260
    9. Public Const MAX_ADAPTER_NAME_LENGTH = 260
    10. Public Const MAX_ADAPTER_ADDRESS_LENGTH = 8
    11. Public Const MAX_ADAPTER_DESCRIPTION_LENGTH = 132
    12. Public Const ERROR_BUFFER_OVERFLOW = 111
    13. Public Const MIB_IF_TYPE_ETHERNET = 1
    14. Public Const MIB_IF_TYPE_TOKENRING = 2
    15. Public Const MIB_IF_TYPE_FDDI = 3
    16. Public Const MIB_IF_TYPE_PPP = 4
    17. Public Const MIB_IF_TYPE_LOOPBACK = 5
    18. Public Const MIB_IF_TYPE_SLIP = 6
    19.  
    20. Type IP_ADDR_STRING
    21.     Next As Long
    22.     IpAddress As String * 16
    23.     IpMask As String * 16
    24.     Context As Long
    25. End Type
    26.  
    27. Type IP_ADAPTER_INFO
    28.     Next As Long
    29.     ComboIndex As Long
    30.     AdapterName As String * MAX_ADAPTER_NAME_LENGTH
    31.     Description As String * MAX_ADAPTER_DESCRIPTION_LENGTH
    32.     AddressLength As Long
    33.     Address(MAX_ADAPTER_ADDRESS_LENGTH - 1) As Byte
    34.     Index As Long
    35.     Type As Long
    36.     DhcpEnabled As Long
    37.     CurrentIpAddress As Long
    38.     IpAddressList As IP_ADDR_STRING
    39.     GatewayList As IP_ADDR_STRING
    40.     DhcpServer As IP_ADDR_STRING
    41.     HaveWins As Boolean
    42.     PrimaryWinsServer As IP_ADDR_STRING
    43.     SecondaryWinsServer As IP_ADDR_STRING
    44.     LeaseObtained As Long
    45.     LeaseExpires As Long
    46. End Type
    47.  
    48. Type FIXED_INFO
    49.     HostName As String * MAX_HOSTNAME_LEN
    50.     DomainName As String * MAX_DOMAIN_NAME_LEN
    51.     CurrentDnsServer As Long
    52.     DnsServerList As IP_ADDR_STRING
    53.     NodeType As Long
    54.     ScopeId  As String * MAX_SCOPE_ID_LEN
    55.     EnableRouting As Long
    56.     EnableProxy As Long
    57.     EnableDns As Long
    58. End Type
    59.  
    60. Public Declare Function GetNetworkParams Lib "IPHlpApi" (FixedInfo As Any, pOutBufLen As Long) As Long
    61. Public Declare Function GetAdaptersInfo Lib "IPHlpApi" (IpAdapterInfo As Any, pOutBufLen As Long) As Long
    62. Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
    63. Sub main()
    64.     'This example was created by George Bernier ([email protected])
    65.     Dim error As Long
    66.     Dim FixedInfoSize As Long
    67.     Dim AdapterInfoSize As Long
    68.     Dim i As Integer
    69.     Dim PhysicalAddress  As String
    70.     Dim NewTime As Date
    71.     Dim AdapterInfo As IP_ADAPTER_INFO
    72.     Dim Adapt As IP_ADAPTER_INFO
    73.     Dim AddrStr As IP_ADDR_STRING
    74.     Dim FixedInfo As FIXED_INFO
    75.     Dim Buffer As IP_ADDR_STRING
    76.     Dim pAddrStr As Long
    77.     Dim pAdapt As Long
    78.     Dim Buffer2 As IP_ADAPTER_INFO
    79.     Dim FixedInfoBuffer() As Byte
    80.     Dim AdapterInfoBuffer() As Byte
    81.    
    82.     'Get the main IP configuration information for this machine using a FIXED_INFO structure
    83.     FixedInfoSize = 0
    84.     error = GetNetworkParams(ByVal 0&, FixedInfoSize)
    85.     If error <> 0 Then
    86.         If error <> ERROR_BUFFER_OVERFLOW Then
    87.            MsgBox "GetNetworkParams sizing failed with error " & error
    88.            Exit Sub
    89.         End If
    90.     End If
    91.     ReDim FixedInfoBuffer(FixedInfoSize - 1)
    92.  
    93.     error = GetNetworkParams(FixedInfoBuffer(0), FixedInfoSize)
    94.     If error = 0 Then
    95.             CopyMemory FixedInfo, FixedInfoBuffer(0), Len(FixedInfo)
    96.             MsgBox "Host Name:  " & FixedInfo.HostName 'host name
    97.             MsgBox "DNS Servers:  " & FixedInfo.DnsServerList.IpAddress 'dns server IP
    98.             pAddrStr = FixedInfo.DnsServerList.Next
    99.             Do While pAddrStr <> 0
    100.                   CopyMemory Buffer, ByVal pAddrStr, Len(Buffer)
    101.                   MsgBox "DNS Servers:  " & Buffer.IpAddress 'dns server IP
    102.                   pAddrStr = Buffer.Next
    103.             Loop
    104.            
    105.             Select Case FixedInfo.NodeType 'node type
    106.                        Case 1
    107.                                   MsgBox "Node type: Broadcast"
    108.                        Case 2
    109.                                    MsgBox "Node type: Peer to peer"
    110.                        Case 4
    111.                                     MsgBox "Node type: Mixed"
    112.                        Case 8
    113.                                     MsgBox "Node type: Hybrid"
    114.                        Case Else
    115.                                     MsgBox "Unknown node type"
    116.             End Select
    117.            
    118.             MsgBox "NetBIOS Scope ID:  " & FixedInfo.ScopeId 'scope ID
    119.             'routing
    120.             If FixedInfo.EnableRouting Then
    121.                        MsgBox "IP Routing Enabled "
    122.             Else
    123.                        MsgBox "IP Routing not enabled"
    124.             End If
    125.             ' proxy
    126.             If FixedInfo.EnableProxy Then
    127.                        MsgBox "WINS Proxy Enabled "
    128.             Else
    129.                        MsgBox "WINS Proxy not Enabled "
    130.             End If
    131.             ' netbios
    132.             If FixedInfo.EnableDns Then
    133.                       MsgBox "NetBIOS Resolution Uses DNS "
    134.             Else
    135.                       MsgBox "NetBIOS Resolution Does not use DNS  "
    136.             End If
    137.     Else
    138.             MsgBox "GetNetworkParams failed with error " & error
    139.             Exit Sub
    140.     End If
    141.    
    142.     'Enumerate all of the adapter specific information using the IP_ADAPTER_INFO structure.
    143.     'Note:  IP_ADAPTER_INFO contains a linked list of adapter entries.
    144.    
    145.     AdapterInfoSize = 0
    146.     error = GetAdaptersInfo(ByVal 0&, AdapterInfoSize)
    147.     If error <> 0 Then
    148.         If error <> ERROR_BUFFER_OVERFLOW Then
    149.            MsgBox "GetAdaptersInfo sizing failed with error " & error
    150.            Exit Sub
    151.         End If
    152.     End If
    153.    ReDim AdapterInfoBuffer(AdapterInfoSize - 1)
    154.  
    155.  ' Get actual adapter information
    156.    error = GetAdaptersInfo(AdapterInfoBuffer(0), AdapterInfoSize)
    157.    If error <> 0 Then
    158.       MsgBox "GetAdaptersInfo failed with error " & error
    159.       Exit Sub
    160.    End If
    161.    CopyMemory AdapterInfo, AdapterInfoBuffer(0), Len(AdapterInfo)
    162.    pAdapt = AdapterInfo.Next
    163.  
    164.    Do While pAdapt <> 0
    165.         CopyMemory Buffer2, AdapterInfo, Len(Buffer2)
    166.           Select Case Buffer2.Type
    167.                 Case MIB_IF_TYPE_ETHERNET
    168.                     MsgBox "Ethernet adapter "
    169.                 Case MIB_IF_TYPE_TOKENRING
    170.                     MsgBox "Token Ring adapter "
    171.                 Case MIB_IF_TYPE_FDDI
    172.                     MsgBox "FDDI adapter "
    173.                 Case MIB_IF_TYPE_PPP
    174.                     MsgBox "PPP adapter"
    175.                 Case MIB_IF_TYPE_LOOPBACK
    176.                     MsgBox "Loopback adapter "
    177.                 Case MIB_IF_TYPE_SLIP
    178.                     MsgBox "Slip adapter "
    179.                 Case Else
    180.                     MsgBox "Other adapter "
    181.         End Select
    182.     MsgBox " AdapterName: " & Buffer2.AdapterName
    183.     MsgBox "AdapterDescription: " & Buffer2.Description 'adatpter name
    184.  
    185.     For i = 0 To Buffer2.AddressLength - 1
    186.            PhysicalAddress = PhysicalAddress & Hex(Buffer2.Address(i))
    187.             If i < Buffer2.AddressLength - 1 Then
    188.              PhysicalAddress = PhysicalAddress & "-"
    189.             End If
    190.  
    191.     Next
    192.     MsgBox "Physical Address: " & PhysicalAddress 'mac address
    193.     If Buffer2.DhcpEnabled Then
    194.             MsgBox "DHCP Enabled "
    195.     Else
    196.             MsgBox "DHCP disabled"
    197.     End If
    198.  
    199.     pAddrStr = Buffer2.IpAddressList.Next
    200.     Do While pAddrStr <> 0
    201.            CopyMemory Buffer, Buffer2.IpAddressList, LenB(Buffer)
    202.            MsgBox "IP Address: " & Buffer.IpAddress
    203.            MsgBox "Subnet Mask: " & Buffer.IpMask
    204.            pAddrStr = Buffer.Next
    205.            If pAddrStr <> 0 Then
    206.             CopyMemory Buffer2.IpAddressList, ByVal pAddrStr, Len(Buffer2.IpAddressList)
    207.            End If
    208.    Loop
    209.     MsgBox "Default Gateway: " & Buffer2.GatewayList.IpAddress
    210.     pAddrStr = Buffer2.GatewayList.Next
    211.     Do While pAddrStr <> 0
    212.             CopyMemory Buffer, Buffer2.GatewayList, Len(Buffer)
    213.             MsgBox "IP Address: " & Buffer.IpAddress
    214.             pAddrStr = Buffer.Next
    215.             If pAddrStr <> 0 Then
    216.             CopyMemory Buffer2.GatewayList, ByVal pAddrStr, Len(Buffer2.GatewayList)
    217.             End If
    218.     Loop
    219.  
    220.     MsgBox "DHCP Server: " & Buffer2.DhcpServer.IpAddress
    221.     MsgBox "Primary WINS Server: " & Buffer2.PrimaryWinsServer.IpAddress
    222.     MsgBox "Secondary WINS Server: " & Buffer2.SecondaryWinsServer.IpAddress
    223.  
    224.     ' Display time
    225.     NewTime = CDate(Adapt.LeaseObtained)
    226.     MsgBox "Lease Obtained: " & CStr(NewTime)
    227.  
    228.     NewTime = CDate(Adapt.LeaseExpires)
    229.     MsgBox "Lease Expires :  " & CStr(NewTime)
    230.     pAdapt = Buffer2.Next
    231.     If pAdapt <> 0 Then
    232.         CopyMemory AdapterInfo, ByVal pAdapt, Len(AdapterInfo)
    233.     End If
    234.  
    235.    Loop
    236.    
    237. End Sub
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  23. #23
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Anti Spoofing MAC Address Change

    do NOT go changing a system setting like the mac address. Some people have their mac address modified because their ISP uses it for authentication, and they've upgraded computers or some such. Deleting that key and resetting their mac address will break their internet connection. That is a VERY bad idea. Changing it in general will screw up internet until a reboot on everyone's computer because it's used for packet routing.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  24. #24

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: Anti Spoofing MAC Address Change

    Quote Originally Posted by Lord Orwell
    do NOT go changing a system setting like the mac address.
    If you read carefully once again, you'll understand that it is not being changed !

    Quote Originally Posted by Lord Orwell
    Some people have their mac address modified because their ISP uses it for authentication, and they've upgraded computers or some such.
    Doesn't a NIC come with a MAC burned in itself ? For what reason should you modify the hard-coded [read-only] MAC Address ? Could you please explain a bit more ?

    Quote Originally Posted by Lord Orwell
    Deleting that key and resetting their mac address will break their internet connection. That is a VERY bad idea. Changing it in general will screw up internet until a reboot on everyone's computer because it's used for packet routing.
    It is not applicable in my case. The software operates on several computers of a network. If you agree, every other system on the LAN might not be connected to ISP oneself !

    On our software license agreement, it is clearly stated that the software users are not allowed to change, modify, spoof, ....., edit the MAC Address in any ways.

    If the ISP needs their MAC address changed, then they will have to get a new ISP's-favorite Network Interface Card.

    Since there are a couple of utilities that can "fake" MAC Address, my concern is just to get the original MAC Address that is programmed into the network card by their manufacturer, not changing a system setting like the mac address.

  25. #25
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: Anti Spoofing MAC Address Change

    I dont know about any other method would work beacuase if Windows is getting the MAC from Registry, will any other method would get it from some where else?
    If you are going to use MAC as the security code base, then what you could do is to search the registry for that key "Netowrk Address" in

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
    Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\
    sub keys.

    Thats how its spoofed.

    Besides all the methods should be using the driver. Otherwise reading it directly from the NIC.

    But not sure if its a reliable method.
    Another thing you could do is to base the key on several Hardware keys.
    Hard Drive , M/B , MAC etc ...
    But if that is changed, then your client will have to get a new key again from you.
    If your agreement has phrase that they cannot change the MAC address by these methods, do a regular search whether they have spoofed the MAC in a way you have found in here.

    If westcon1's function doesnt give you results, then I think thats what you would have to do.

    IIF(Post.Rate > 0 , , )

  26. #26
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Anti Spoofing MAC Address Change

    Doesn't a NIC come with a MAC burned in itself ? For what reason should you modify the hard-coded [read-only] MAC Address ? Could you please explain a bit more ?
    why they spoof there mac address it not the point, it is unlikely they are doing without good reason, it is not up to software developers to determine how users should set up their computers
    reading the original mac from the card is fine, but not to force them to use it
    note also that many computers have multiple NICs, some of which are removable, not permanent, like usb wireless cards or pccard, so you need to determin if the card is permanent or other cards are peresent
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  27. #27
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Anti Spoofing MAC Address Change

    Even routers with mac addresses allow cloning. The suggestion to determine if its an onboard nic or an add on card nic would prove more reliable if its a mobo one but to determine the difference...
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  28. #28
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Anti Spoofing MAC Address Change

    even worse, some computers don't have NICs at all, and in that case, the call returns a different number every single time it is called.

    I really don't think it will affect your licensing one way or the other. If they decide to clone the mac address onto every system, that will invalidate the ability of the computers to share a single internet connection, which is pretty much required in most large businesses.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  29. #29
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Anti Spoofing MAC Address Change

    More then likely anyone that wants to "hack" the software wont be doing it or running it in a business environment.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  30. #30
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    why don't you base the protectoin on something that CAN'T be spoofed, like the hard-drive serial number and dimensions?
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  31. #31
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    HDs go out too often. I would use the CPU as the most consistent piece of hardware to generate any alogorithum off of. Add a couple of other hardware items that wont get changed too ofter like amount of RAM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  32. #32
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Well that's pretty much how microsoft does it. They come up with some number based on system metrics and small changes are ignored. A large change makes you call them and explain!
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  33. #33
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Yup, one other sure fire way is to use one of the loopback adapter hardware keys. You cant use the software without it being verified with the key. Only problem is that you will have to ship it out to the customers that purchase your software.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  34. #34

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Greetings to all,

    It's been a long time to vbforum. Till now, our software licensing relies on MAC address and for me, it has proven to be 'hacker safe' untill and unless someone is able to know the algorithm and technique used to generate serial numbers for unique MAC Addresses.

    What I've implemented is:
    • It's very easy to know if MAC Address has been modified or spoofed.
    • The software will not work if there is a change or modification in MAC Address (Spoofing).
    • If the MAC address has not been altered, each users must have unique serial numbers.

  35. #35
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Quote Originally Posted by nepalbinod
    Greetings to all,

    It's been a long time to vbforum. Till now, our software licensing relies on MAC address and for me, it has proven to be 'hacker safe' untill and unless someone is able to know the algorithm and technique used to generate serial numbers for unique MAC Addresses.

    What I've implemented is:
    • It's very easy to know if MAC Address has been modified or spoofed.
    • The software will not work if there is a change or modification in MAC Address (Spoofing).
    • If the MAC address has not been altered, each users must have unique serial numbers.
    it's not an algorithm. The first half of a mac address is a code assigned to a particular manufacturer and the 2nd half is a manufacturer's serial number. Since there are a finite number of allowed digits, duplicates can exist. For this reason, many modern network cards allow you to reprogram a custom mac address.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  36. #36

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Quote Originally Posted by Lord Orwell
    it's not an algorithm. The first half of a mac address is a code assigned to a particular manufacturer and the 2nd half is a manufacturer's serial number. Since there are a finite number of allowed digits, duplicates can exist. For this reason, many modern network cards allow you to reprogram a custom mac address.
    Please do note that I mentioned algorithm used to generate serial number for each (unique) MAC Address. For example, if a MAC Address is 0021523456FA, the serial number would be something like: Wdf3B eGPD0 GEOD5 4kSG1 8LSG9. The serial number will be different for each MAC address. If anyone modifies it, there will be an entry in the registry which can be caught easily. The software will not work under the condition when MAC Address has been altered.

    I hope, I was clear this time...

  37. #37
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Quote Originally Posted by nepalbinod
    Please do note that I mentioned algorithm used to generate serial number for each (unique) MAC Address. For example, if a MAC Address is 0021523456FA, the serial number would be something like: Wdf3B eGPD0 GEOD5 4kSG1 8LSG9. The serial number will be different for each MAC address. If anyone modifies it, there will be an entry in the registry which can be caught easily. The software will not work under the condition when MAC Address has been altered.

    I hope, I was clear this time...
    oh, sorry. I thought you were saying "generating the mac address". I probably read it wrong. Thanks for the clarification.

    In the event someone upgrades, you might be able to add some kind of option to your program that lets them contact customer support for a new code as long as they can give a reasonable explanation for the old one not working any more. Say, it's been two years, you can reasonably expect an upgrade in that time. How about storing BOTH the hard drive AND the mac address in the hash? And only having one be required? This could cut down on customer complaints because if your program detected a change of just one of them it could automatically generate a new hash off the new hardware.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  38. #38

    Thread Starter
    Hyperactive Member nepalbinod's Avatar
    Join Date
    Sep 2007
    Posts
    293

    Re: [RESOLVED] Anti Spoofing MAC Address Change

    Quote Originally Posted by Lord Orwell
    oh, sorry. I thought you were saying "generating the mac address". I probably read it wrong. Thanks for the clarification.

    In the event someone upgrades, you might be able to add some kind of option to your program that lets them contact customer support for a new code as long as they can give a reasonable explanation for the old one not working any more. Say, it's been two years, you can reasonably expect an upgrade in that time. How about storing BOTH the hard drive AND the mac address in the hash? And only having one be required? This could cut down on customer complaints because if your program detected a change of just one of them it could automatically generate a new hash off the new hardware.
    You're right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width