How to generate a serial number?
How to generate a serial number?
I want to implement a licensing, generating a serial number from the computer the software is running on (so the program at start will check his licensing against my database).
How do I get a unique serial number, from a computer?
How do I get a unique serial number, from a computer?
Re: How to generate a serial number?
Hi, just in advance.
Software with such constructions is often hated like the plague and rightly so, as I think myself.
It is possible, business models of windy distributors are based on such a thing, then it is added that you can only install it three times and the software is offered under about five different names.
Software with such constructions is often hated like the plague and rightly so, as I think myself.
It is possible, business models of windy distributors are based on such a thing, then it is added that you can only install it three times and the software is offered under about five different names.
Last edited by Saki on Sat Sep 05, 2020 10:31 am, edited 1 time in total.
地球上の平和
Re: How to generate a serial number?
Use the MAC address. It should be unique.
Re: How to generate a serial number?
If you want a more robust implementation, you can use "the enigma protector", it's not free, but you have many ways of protect your software.
I was use it sometimes in the past, however infalible protection doesn't exists
I was use it sometimes in the past, however infalible protection doesn't exists
Re: How to generate a serial number?
The MAC address is easily changed -> https://www.howtogeek.com/192173/how-an ... x-and-mac/infratec wrote:Use the MAC address.
Re: How to generate a serial number?
My network drivers don't support this.In the properties window, on the “Advanced” tab and select the “Network Address” entry in the “Property” list. If you don’t see this option, then your network driver doesn’t support this feature.
Btw.: each 'security' stuff is 'hackable'. It is only a question of 'do I really want to crack it'
And even if someone changes the MAC address, to which address should it be changed?
For this knowledge the user needs an alreday installed version of the software, or he has to test a lot of numbers.
Last edited by infratec on Sat Sep 05, 2020 1:39 pm, edited 1 time in total.
Re: How to generate a serial number?
The point I'm making is that if two or more friends have supported MAC addresses that can be changed, then only one has to buy and the others can use his MAC address on their PC to avoid buying.
Re: How to generate a serial number?
Mac address should work for me. Anyway, it's there a way to get a hardware Id?
Re: How to generate a serial number?
You can use a mix of: HardDisk SN, Processor,BIOS, MAC, Windows User, and so on...
Re: How to generate a serial number?
Yeah, I know. My question is how to read this numbers...
Re: How to generate a serial number?
Sometimes is better if you search through google instead of forum it self:AMpos wrote:Yeah, I know. My question is how to read this numbers...
Something like: Purebasic + "whatever you are searching" cast interesting results
Re: How to generate a serial number?
You can use also the cpu serial number (not my job):
Code: Select all
Procedure.s GetCPUSerialNumber()
Define highbits.l
Define lowbits.l
Define serial.q
!MOV eax, $80000003
!CPUID
!MOV dword [p.v_lowbits], ecx
!MOV dword [p.v_highbits], edx
serial = lowbits | highbits << 32
ProcedureReturn Hex(serial,#PB_Quad)
EndProcedure
Debug GetCPUSerialNumber()
PureBasic: Surprisingly simple, diabolically powerful
Re: How to generate a serial number?
Online and hardware activation sucks when the developer ups and quits development and you no longer can activate your purchased software. Here's some code. Read the comments.
Code: Select all
;-Run this bit of code in a separate progam to create the encrupted key.
UseSHA2Fingerprint()
Debug StringFingerprint("G4112h78ab", #PB_Cipher_SHA2)
;-Use this in your actual program so a user can activate their software.
Activation.a = 0
If OpenWindow(0, 0, 0, 310, 40, "Verify Key", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(0, 10, 10, 200, 20, "")
ButtonGadget(1, 210, 10, 100, 20, "Activate")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
If Activation = 0 ;-You will have to figure out how to store Activation if it equals 1 on your own.
If StringFingerprint(GetGadgetText(0), #PB_Cipher_SHA2) = "048339c50de4e5f29f5c91c7eba9c9a0a3e294fea0fa684193664f21f6c0a78c"
Debug "Yahoo!"
Else
Debug "Incorrect Key"
EndIf
EndIf
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT
Even the vine knows it surroundings but the man with eyes does not.
Re: How to generate a serial number?
Just a note... anyone who is wanting a simple licensing system "to protect their software" needs to be aware that once their application is compiled/assembled it can also be disassembled.
You can end up spending more time trying to protect your software than actually developing it.
For example, in J.Baker's code the line that checks if the correct code has been entered...
Of course mean "If entered code" = "Correct Code" then "Success"
and in ASM the "=" is "JE" , jump if equal, or opcode $74
Now if you reverse this logic you get...
"If entered code" <> "Correct Code" then "Success"
and in ASM the "<>" is "JNE", jump not equal, or opcode $75
Poke can easily change $74 to $75 so incorrect code will always give "Success".
A very simplified example... compile J.Baker's code to "MyApp.exe" either 64bit or 32bit
Now run the following code which will scan through your compiled EXE and find the $74, change it to $75 and save it as a new EXE
This demonstrated how modifying a single byte in a file can totally change it's behavior.
You can end up spending more time trying to protect your software than actually developing it.
For example, in J.Baker's code the line that checks if the correct code has been entered...
Code: Select all
If StringFingerprint(GetGadgetText(0), #PB_Cipher_SHA2) = "048339c50de4e5f29f5c91c7eba9c9a0a3e294fea0fa684193664f21f6c0a78c"
and in ASM the "=" is "JE" , jump if equal, or opcode $74
Now if you reverse this logic you get...
"If entered code" <> "Correct Code" then "Success"
and in ASM the "<>" is "JNE", jump not equal, or opcode $75
Poke can easily change $74 to $75 so incorrect code will always give "Success".
A very simplified example... compile J.Baker's code to "MyApp.exe" either 64bit or 32bit
Code: Select all
UseSHA2Fingerprint()
Activation.a = 0
If OpenWindow(0, 0, 0, 310, 40, "Verify Key", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(0, 10, 10, 200, 20, "")
ButtonGadget(1, 210, 10, 100, 20, "Activate")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
If Activation = 0 ;-You will have to figure out how to store Activation if it equals 1 on your own.
If StringFingerprint(GetGadgetText(0), #PB_Cipher_SHA2) = "048339c50de4e5f29f5c91c7eba9c9a0a3e294fea0fa684193664f21f6c0a78c"
MessageRequester("Success","Yahoo!")
Else
MessageRequester("Error","Incorrect Key")
EndIf
EndIf
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
This demonstrated how modifying a single byte in a file can totally change it's behavior.
Code: Select all
file$="C:\MyApp.exe"
hFile=ReadFile(#PB_Any,file$)
If hFile
lf=Lof(hFile)
*buf=AllocateMemory(lf)
ReadData(hFile,*buf,lf)
CloseFile(hFile)
For tmp=0 To lf-3
If (PeekA(*buf+tmp)=$74 And PeekA(*buf+tmp+1)=$28 And PeekA(*buf+tmp+2)=$48 And PeekA(*buf+tmp+3)=$B8) Or ;64bit EXE byte sequence
(PeekA(*buf+tmp)=$74 And PeekA(*buf+tmp+1)=$13 And PeekA(*buf+tmp+2)=$B8) ;32bit EXE byte sequence
PokeA(*buf+tmp,$75)
hFile=CreateFile(#PB_Any,GetPathPart(file$)+GetFilePart(file$,#PB_FileSystem_NoExtension)+"-patched.exe")
If hFile
WriteData(hFile,*buf,lf)
CloseFile(hFile)
Debug "File Patched"
EndIf
FreeMemory(*buf)
Break
EndIf
Next
EndIf