Page 1 of 1
Protect your APPs with Mother board serial
Posted: Sat Oct 12, 2024 9:53 pm
by minimy
As title said.
Code: Select all
Procedure.s CLIreturn(prg.s, comando.s)
Protected salida.s
comando = ReplaceString(comando,"'",Chr(34))
idprg= RunProgram(prg, comando, GetPathPart(prg), #PB_Program_Open|#PB_Program_Read|#PB_Program_Error|#PB_Program_Hide)
If IsProgram(idprg)
While ProgramRunning(idprg)
If AvailableProgramOutput(idprg)
salida + ReadProgramString(idprg) + #CRLF$
EndIf
error$ = ReadProgramError(idprg)
If error$ <> ""
salida + error$ + #CRLF$
EndIf
Wend
EndIf
ProcedureReturn salida
EndProcedure
Procedure.s motherBoardserial()
; wmic baseboard get product,Manufacturer,version,serialnumber
; wmic baseboard get serialnumber
Protected.s r= CLIreturn("cmd","/c wmic baseboard get serialnumber")
ProcedureReturn StringField(r,2,#CRLF$)
EndProcedure
Debug motherBoardserial()
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 2:41 am
by moricode
minimy wrote: Sat Oct 12, 2024 9:53 pm
As title said.
Code: Select all
Procedure.s CLIreturn(prg.s, comando.s)
Protected salida.s
comando = ReplaceString(comando,"'",Chr(34))
idprg= RunProgram(prg, comando, GetPathPart(prg), #PB_Program_Open|#PB_Program_Read|#PB_Program_Error|#PB_Program_Hide)
If IsProgram(idprg)
While ProgramRunning(idprg)
If AvailableProgramOutput(idprg)
salida + ReadProgramString(idprg) + #CRLF$
EndIf
error$ = ReadProgramError(idprg)
If error$ <> ""
salida + error$ + #CRLF$
EndIf
Wend
EndIf
ProcedureReturn salida
EndProcedure
Procedure.s motherBoardserial()
; wmic baseboard get product,Manufacturer,version,serialnumber
; wmic baseboard get serialnumber
Protected.s r= CLIreturn("cmd","/c wmic baseboard get serialnumber")
ProcedureReturn StringField(r,2,#CRLF$)
EndProcedure
Debug motherBoardserial()
hi , dude , what i get is this in return string : " To be filled by O.E.M. "

Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 2:51 am
by moricode
Code: Select all
Debug CLIreturn("cmd","/c wmic baseboard get product")
Debug CLIreturn("cmd","/c wmic baseboard get Manufacturer")
Debug CLIreturn("cmd","/c wmic baseboard get version")
Debug CLIreturn("cmd","/c wmic baseboard get serialnumber")
This is what i get :
Product
B85M-D3H-A
Manufacturer
Gigabyte Technology Co., Ltd.
Version
x.x
SerialNumber
To be filled by O.E.M.

Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 8:54 am
by BarryG
Pro Tip: Don't do this. I did this with my app and got CONSTANT support emails about my app's license keys not working because the user updated their BIOS. It happened quite a lot (well, about 10 emails per month from different users) and just became too much hassle to deal with. I don't know if they were just saying it to get extra free keys or not (likely), so I switched to an email-based key (using their PayPal email) and left it at that. That way the key still works if their BIOS is "upgraded", and they're less likely to share their key because spammers will get their valid email address. It also removed the work at my end to send out new keys every month.
Also, calling WMIC in your app is a trigger for anti-virus apps and can give it a false-positive. Personal experience.
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 11:12 am
by minimy
BarryG wrote: Mon Oct 14, 2024 8:54 am
Pro Tip: Don't do this. I did this with my app and got CONSTANT support emails about my app's license keys not working because the user updated their BIOS. It happened quite a lot (well, about 10 emails per month from different users) and just became too much hassle to deal with. I don't know if they were just saying it to get extra free keys or not (likely), so I switched to an email-based key (using their PayPal email) and left it at that. That way the key still works if their BIOS is "upgraded", and they're less likely to share their key because spammers will get their valid email address. It also removed the work at my end to send out new keys every month.
Also, calling WMIC in your app is a trigger for anti-virus apps and can give it a false-positive. Personal experience.
Hello Barry, thanks for comments and help. Right is not the best practic to protect, i think DriveGUID combined with another unique ID is better
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 12:24 pm
by NicTheQuick
This is also not a safe way to do it. Calling an external command with no absolute path means that you could simply write your own `wmic` command, put it in the working directory and it will return whatever you want it to return.
Better use an API for that and if you need to load it dynamically, use absolute paths.
And yes, I know that someone could replace `wmic` in system folders too but that's at least a bit less likely.
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 12:51 pm
by BarryG
@minimy: Also, your code in your first post returns an empty string for me, so it doesn't work on all PCs anyway.
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 3:11 pm
by Paul
Is it possible WMIC command will disappear at some point?
https://learn.microsoft.com/en-us/windo ... misdk/wmic
Important
WMIC is deprecated as of Windows 10, version 21H1; and as of the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI; see Chapter 7 - Working with WMI. This deprecation applies only to the WMIC utility. Windows Management Instrumentation (WMI) itself is not affected. Also see Windows 10 features we're no longer developing.
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 3:13 pm
by NicTheQuick
If you're using Linux you can look into the virtual directory `/sys/class/dmi/id/`. There you can find all sorts of information about your system:
Code: Select all
$ ll /sys/class/dmi/id/
insgesamt 0
drwxr-xr-x 3 root root 0 Okt 14 14:27 ./
drwxr-xr-x 3 root root 0 Okt 7 19:35 ../
-r--r--r-- 1 root root 4096 Okt 12 16:53 bios_date
-r--r--r-- 1 root root 4096 Okt 12 16:53 bios_release
-r--r--r-- 1 root root 4096 Okt 7 19:35 bios_vendor
-r--r--r-- 1 root root 4096 Okt 8 09:48 bios_version
-r--r--r-- 1 root root 4096 Okt 12 16:53 board_asset_tag
-r--r--r-- 1 root root 4096 Okt 8 09:48 board_name
-r-------- 1 root root 4096 Okt 12 16:53 board_serial
-r--r--r-- 1 root root 4096 Okt 7 19:35 board_vendor
-r--r--r-- 1 root root 4096 Okt 12 16:53 board_version
-r--r--r-- 1 root root 4096 Okt 12 16:53 chassis_asset_tag
-r-------- 1 root root 4096 Okt 12 16:53 chassis_serial
-r--r--r-- 1 root root 4096 Okt 8 09:48 chassis_type
-r--r--r-- 1 root root 4096 Okt 12 16:53 chassis_vendor
-r--r--r-- 1 root root 4096 Okt 12 16:53 chassis_version
-r--r--r-- 1 root root 4096 Okt 7 19:35 modalias
drwxr-xr-x 2 root root 0 Okt 8 10:23 power/
-r--r--r-- 1 root root 4096 Okt 8 09:48 product_family
-r--r--r-- 1 root root 4096 Okt 7 19:35 product_name
-r-------- 1 root root 4096 Okt 12 16:53 product_serial
-r--r--r-- 1 root root 4096 Okt 8 09:48 product_sku
-r-------- 1 root root 4096 Okt 7 19:35 product_uuid
-r--r--r-- 1 root root 4096 Okt 7 19:35 product_version
lrwxrwxrwx 1 root root 0 Okt 7 19:35 subsystem -> ../../../../class/dmi/
-r--r--r-- 1 root root 4096 Okt 7 19:35 sys_vendor
-rw-r--r-- 1 root root 4096 Okt 7 19:35 uevent
But as you can see the serial and uuid numbers are not accessible without becoming root. And you can see the difference between `board_serial` and `product_serial`. The latter also shows "To be filled by O.E.M." on my PC because I built it by myself and no OEM was involved in any way. But `board_serial` contains the correct serial number of my mainboard.
Re: Protect your APPs with Mother board serial
Posted: Mon Oct 14, 2024 8:23 pm
by tj1010
Oreans Code Virtualizer supports PB across Windows, Linux, and MacOS. Put a server license check in it with a embedded x.509 for TLS and a xor cipher in the VM incase they hook calls to TLS buffers. An attacker can't just patch some jumps or intercept network calls to crack your product..
Even this will be defeated the second your product gets an audience, though.. You'd need something like Intel SGX across all CPUs to actually keep someone from opening up a binary and reverse engineering important parts of it.. This is why you can't play UHD blueray on non-SGX processors; AACS 2.x code isn't decrypted till in a Intel SGX enclave loaded by a licensed player software.. AMD has a SGX equivalent called Presidio, but nobody uses it for anything..