Author Topic: Locking Application to Specific Computer  (Read 1424 times)

alfig_controls

  • Newbie
  • *
  • Posts: 4
    • View Profile
Locking Application to Specific Computer
« on: September 23, 2022, 02:07:41 PM »
Hi All,

I'm trying to implement a sort of security to where the application only works on a specific computer. I'm thinking I can have a hash of the Mac Address that the user has to type in prior to loading the main form. Just curious if anyone has done something similar before? How did you go about it. The application would still be fully open source, but I don't want it to run anywhere else besides the machine server that sits next to the machine.


dmroeder

  • Global Moderator
  • Full Member
  • *****
  • Posts: 206
    • View Profile
Re: Locking Application to Specific Computer
« Reply #1 on: September 23, 2022, 03:38:54 PM »
Hi All,

I'm trying to implement a sort of security to where the application only works on a specific computer. I'm thinking I can have a hash of the Mac Address that the user has to type in prior to loading the main form. Just curious if anyone has done something similar before? How did you go about it. The application would still be fully open source, but I don't want it to run anywhere else besides the machine server that sits next to the machine.

I suppose one way would be to hard code the computers hostname in the application.  So in the form load event  If Environment.MachineName isn't equal to your servers hostname, exit.

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Locking Application to Specific Computer
« Reply #2 on: September 29, 2022, 09:17:33 PM »
The code below will get the macAddress for the connected Enet adapter, thus avoid mac spoofing.

Code: [Select]
For Each nic As NetworkInterface In NetworkInterface.GetAllNetworkInterfaces()

            If nic.OperationalStatus = OperationalStatus.Up Then
                macAddresses += nic.GetPhysicalAddress().ToString()
                Exit For
            End If
        Next

        If macAddresses.Contains("WS_MacAddress") Then
            'Run software
        Else
            'exit
        End If
« Last Edit: September 29, 2022, 09:22:52 PM by bachphi »
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================