Software Protection / Motherboard Serial number

Talk about anything
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Software Protection / Motherboard Serial number

04 Nov 2016, 15:15

I've got some software that I'm hopeful I will get people willing to pay for. :) As with most things, trying to make them "100% safe" is not realistic. (locks on homes keep out the 98% of people that will try the handle and then move on).

I'm taking this approach for my software license in that I want to have a very basic, easy to implement, license that will stop most of the honest people.

For this reason I decided to get a "hardware footprint" to tie to a given customer's email address. I reviewed this thread on WMI tasks https://autohotkey.com/boards/viewtopic.php?t=1976 and created the below code which should grab a given computer's motherboard Serial number. I've tried it on 6 computers so far and it reliably pulled back a value. I'd LOVE to have a better idea of the ratio it will pull back a value instead of returning a Null.

If you're willing, please run the below code and let me know if it displayed an id or a null (I don't need to see the value)

Thank you!

Code: Select all

While (ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . A_ComputerName . "\root\cimv2").ExecQuery("Select * From Win32_BaseBoard")._NewEnum)[objMBInfo]
	MsgBox % objMBInfo["SerialNumber"]
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: Software Protection / Motherboard Serial number

05 Nov 2016, 20:07

On my quite old win 7 32bit laptop I get an ID.
Please excuse my spelling I am dyslexic.
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Software Protection / Motherboard Serial number

05 Nov 2016, 20:20

On a HP 6005 Pro desktop I get an ID.
On a Dell 490 tower I get an ID prefixed by 2 commas.
On a Dell Latitude E7440 laptop I get an ID with a forward slash at both the beginning and end.
On a VMWare VM I get a null (as I would expect. :) )

Hope this helps...

PS - As the results appear to be variable, have you considered using the ethernet adaptor MAC address (which at least has fewer variations in string composition)?

Code: Select all

objWMIService := ComObjGet("winmgmts:{impersonationLevel = impersonate}!\\.\root\cimv2")
colItems := objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")._NewEnum
while colItems[objItem]
    if objItem.IPAddress[0] = A_IPAddress1
        MsgBox % objItem.MACAddress
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 07:17

Thanks guys! From what I read using a MAC address was less reliable/consistent. I"ll review and consider it though. thank you for testing! :)
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 10:25

Joe Glines wrote:From what I read using a MAC address was less reliable/consistent.
Probably because you can change the MAC address using a registry edit... but, realistically, how many people know how to do this and/or would do it if it broke their software licensing? :)
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 11:06

Agreed. The target market i'm planning to appeal to are non-programmers so it probably wouldn't matter.

BTW- I borrowed & tweaked my code from that original post but I can't claim to understand a lick of it (nor can I follow yours) Could you go back and annotate it to help me understand what they are doing? :oops:
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 13:32

Joe Glines wrote:BTW- I borrowed & tweaked my code from that original post but I can't claim to understand a lick of it (nor can I follow yours) Could you go back and annotate it to help me understand what they are doing? :oops:
ROFL. I've seen some of your posts on http://the-automator.com/ and you're streets ahead of me!

For creating WMI queries from scratch I still tend to use the Scriptomatic V2 for Win 7 HTA to construct the initial query then check out AHK - WMI - Snippets (https://autohotkey.com/boards/viewtopic ... &hilit=WMI) to see whether I have the AHK code right.

Code: Select all

While (ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . A_ComputerName . "\root\cimv2").ExecQuery("Select * From Win32_BaseBoard")._NewEnum)[objMBInfo]
	MsgBox % objMBInfo["SerialNumber"]
I'm sure someone will correct me if I'm wrong but, to me, all this means is to run a WMI query against the Win32_BaseBoard collection and return the result for the object named SerialNumber. If you use Scriptomatic it will show you every available object available for each collection. Sorry, I don't use WMI often enough to have found a better tool... although I'm sure one or more exists.

Code: Select all

objWMIService := ComObjGet("winmgmts:{impersonationLevel = impersonate}!\\.\root\cimv2")
colItems := objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")._NewEnum
while colItems[objItem]
    if objItem.IPAddress[0] = A_IPAddress1
        MsgBox % objItem.MACAddress
Similarly, all this means is run a WMI query against all Win32_NetworkAdapterConfiguration collections that have IPEnabled set to True and return the result for the object named MACAddress. This way it will catch the active network adaptor and ignore inactive or pseudo/virtual adapters.

WMI can sometimes be a little flaky, especially now that PowerShell has gained such a foothold (which is why I've been playing with wrapping PowerShell cmdlets in AHK). Whilst PowerShell still supports WMI cmdlets, some WMI classes have been deprecated and I guess this trend will continue. Have a read of this CIM vs. WMI CmdLets – The top reasons I changed over article (http://maikkoster.com/cim-vs-wmi-cmdlet ... i-changed/). On the other hand, most WMI queries will remain for some time... and only MS can tell us how long that will be.

Hope this helps...
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 18:41

Thank you! I'll review your points and articles. :) It's good to have homework! :)
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 19:22

tmplinshi wrote:I get To be filled by O.E.M.
Sorry but... it's difficult to know what you're referring to unless you quote a post.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Software Protection / Motherboard Serial number

07 Nov 2016, 19:31

By running this code:

Code: Select all

While (ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . A_ComputerName . "\root\cimv2").ExecQuery("Select * From Win32_BaseBoard")._NewEnum)[objMBInfo]
	MsgBox % objMBInfo["SerialNumber"]
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Software Protection / Motherboard Serial number

08 Nov 2016, 07:43

tmplinshi wrote:By running this code:

Code: Select all

While (ComObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . A_ComputerName . "\root\cimv2").ExecQuery("Select * From Win32_BaseBoard")._NewEnum)[objMBInfo]
	MsgBox % objMBInfo["SerialNumber"]
Ah! Got you! Sorry, it was me being thick... You were replying to Joe Glines' original post. I suspect Joe would be interested in make/model (or mainboard) of device that returned To be filled by O.E.M.
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Software Protection / Motherboard Serial number

08 Nov 2016, 09:26

I am more interested in the incident rate than I am any given board. From the testing I've done/seen above it does look very likely that it "usually" (probably over 90% of the time) will return a unique value. In That fact it returned "To be filled by O.E.M" by tmplinshi means it won't always be perfect but I'm not looking for perfect.
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: Software Protection / Motherboard Serial number

08 Nov 2016, 10:02

you should Hash the value that you get regardless. so even if you get that "OEM" message, after you Hash it, it will look like gibberish. depending on the Hash method you may get duplicates

i am protecting my software using some of the old Lazslo code, basically getting a machine fingerprint from the EnvGet variables as well as a CPUinfo() Mcode. the values are then hashed to give a machine fingerprint. its not completely unique, as i've run into a few duplicates, but nothing that really matters. i will look into this WMI stuff

my ahk script then calls a php script on my website, which stores the machine ID. when they purchase a license, i supply them with a random license code, and then i also store that code in the same database. then each time they use the script, it contacts out to the web database to verify the license.

originally i only allowed the software to be installed on 2 machines, which i would save both machine id's in the database. but ive since added a check that allows them to use the software on as many computers as they want, just not simultaneously. upon license check, if the license is already open on another machine, the check fails. i also allow one false positive every X days, incase of a computer crash where the license never gets unlocked when they exit

i really should abstract the whole thing out so others can use it. maybe even charge something ;)

User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Software Protection / Motherboard Serial number

08 Nov 2016, 10:51

guest3456 wrote:you should Hash the value that you get regardless. [...]
+1 :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Software Protection / Motherboard Serial number

08 Nov 2016, 11:05

@JoeDF- yes, that is the plan. I'll combine it with an email address first, then have an encrypted value.
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!

Return to “Off-topic Discussion”

Who is online

Users browsing this forum: No registered users and 75 guests