Mac address vs. Hardware serial id

I have had a rudimentary ‘copy protection’ in place that relied on Mac address (used from networkutils) to see how many devices a user has installed the software on.

Now it turns out that on certain MacBooks there is an Ibridge network service that uses the same Mac address for each unit… Whereas I always thought that Mac addresses were unique to each machine and interface.

Obviously this is no good for the protection mechanisms and is giving false positives for certain clients.

Hardware serial id’s have been mentioned in other topics but I haven’t seen any actual implementation of that. Another approach would be to ignore the Ibridge adapter and use another (if available), but the networkutils feature just seems to fetch the first one it finds.

Anyone else encounter this and has some best practices on how to proceed?

Hi Maker_Bob,

I’m using this one on windows

//--------------------------------------------------------------
bool ofApp::getUUID() {
DWORD dwSerial;
bool result;
stringstream ss;

if (!GetVolumeInformation(_T("C:\\"), NULL, 0, &dwSerial, NULL, NULL, NULL, 0)) {
	ss << "Error: " << GetLastError();
}
else {
	ss << hex << dwSerial;
}
if (ss.str() == "xxxxxx") result = true;	//my computer
else result = false;
//cout << ss.str() << endl;
return result;
}

It’s working well since several years

2 Likes

Hi there, I’ve recently had to figure this out and it turns out there is a unique identifier built into Macs. You can get it in terminal using :

system_profiler SPHardwareDataType | awk '/UUID/ { print $3; }'

Here’s some code that works in oF, only currently tested in OSX but will be tested on Windows soon.


#ifdef TARGET_OSX
        string command = "system_profiler SPHardwareDataType | awk '/UUID/ { print $3; }'";
#endif
#ifdef _MSC_VER
        string command = "cmd /c powershell.exe -Command \"(Get-CimInstance -Class Win32_ComputerSystemProduct).UUID\"\n"";
#endif
#ifdef TARGET_LINUX
        string command = "findmnt --output=UUID --noheadings --target=/boot";
#endif
        
        string machineid = exec(command.c_str());
        ofStringReplace(machineid,"\n","");

Thanks to cryprolens.io for these methods outlined on this page :
General FAQ - Cryptolens Docs & Support for Licensing and Payments

Hope this helps!

Seb