How can I retrieve the processor serial number with Matlab?
Afficher commentaires plus anciens
Hi!
I have written a Matlab code that I want to sell as an Excel add-in. To protect the program and to know when each user uses the add-in, I would like to include the following in my Matlab program: 1. Get the serial number of the computer you are on. 2. Send the serial number to a server (so that the server knows that the program has been used) in an encrypted form. 3. Receive an encrypted answer from the server and perform the calculation only if the license is valid on this computer.
My question is: how do I do step 1 in Matlab? Is there a function that retrieves the serial number of the computer on which Matlab is running?
Many thanks in advance!
Benoit
Réponses (4)
Jan
le 7 Fév 2011
There is no unique serial number of a computer. Therefore you cannot obtain it.
Beside the ethernet MAC address, you can use the user's SID, see Yair's GetSID: http://www.mathworks.com/matlabcentral/fileexchange/15718. Then you find the ProductID of Windows in the registry (I cn check this for XP only):
winqueryreg('HKEY_LOCAL_MACHINE', ...
SOFTWARE\Microsoft\Windows\CurrentVersion', 'ProductID')
In the registry you find the InstallDate, DigitalProductID and LicenseInfo also. To get the vendor-IDs of the harddisks and other installed hardware, you can use:
!powercfg /devicequery all_devices_verbose
But POWERCFG may be restricted to admins also. And most of all: This works for Windows only!
Finally you have to consider the local laws for privacy protection: It may be a problem if you track the work of each user in real-time. I'd personally would never accept such a control on principle. Controlling the validity of the license during the installation causes enough problems already.
Benoît
le 6 Fév 2011
0 votes
4 commentaires
Matt Fig
le 6 Fév 2011
Please delete this "answer" and put a comment on my actual answer. Then I can comment back.
Walter Roberson
le 6 Fév 2011
Unix doesn't have a wmic command.
If you ask about the serial number of a *processor* then you need to be concerned about what answer you will get if the system has multiple processors.
One common approach is to get the MAC (Media Access Control) of the "primary" ethernet card. However, that can fail if the ethernet cards are changed or if a built-in ethernet (e.g., on a Dell) is disabled and replaced with an ethernet card, or if it is not possible to determine which is the "primary" ethernet card. Still, the technique is widely used, more so than processor serial numbers.
From time to time you will encounter a program that takes the serial number of the first hard drive. I personally consider that to be a poor decision, as it is common to change hard drives.
Benoît
le 6 Fév 2011
Walter Roberson
le 6 Fév 2011
Unfortunately getting the MAC can be OS specific. Usually though you can get it by parsing the output of the system command
ifconfig
but in some OS you might have to include an interface name. Also, determining which is the "primary" ethernet card can be hard. In the old days, BSD Unix derived systems often had a "primary" flag that could be set against a single ethernet interface, but as it become common to have multiple interfaces it fell out of use as being too limiting.
Jan
le 19 Oct 2016
0 votes
For getting the MAC address: https://www.mathworks.com/matlabcentral/answers/289469-checking-physical-address-of-the-computer
Catégories
En savoir plus sur Texas Instruments C2000 F28M3x Concerto Processors dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!