Post by atomose on Feb 18, 2023 8:13:58 GMT -5
hi,
As some know, I embarked on the adventure of making commercial games using LibertyBasic (yes it's not a joke ^^).
The main problem I encounter is the turnkey sale of one of my software or games. Indeed, other languages have the advantage of having third-party or directly integrated programs that allow you to request a software key activation to use the game or software. Out here, no, so everyone can give themselves the file and not get paid....it's annoying when it comes to professional work!
So I leaned on a program directly incorporated into the source code which would allow to have a security in order to be able to market its games or software quietly.
This is how "LibertyBasic Shield" was born!
The idea is simple, when you buy one of your software, you are asked for an activation code when you open it for the first time (Of course, you give it to the customer when you buy it and it must be different for each customer) .
Once he validates the code, a license file is created.
This will allow the customer not to have to give this code each time they open. The file created is unique per customer. It contains the license number. If this is modified, a message will state that the code is no longer valid. If it is deleted, the client will have to redo the operation. If the file is forwarded to someone, they will automatically have to forward the license number for it to work. So if a number is assigned to each customer, it is very easy to know who illegally transmitted your software!
The first part of the code generates a desired number of keys (the more you ask for, the longer it will take to generate... on average if you ask for 20,000, it takes 1-2 minutes). The keys are then saved in a text file.
The second part allows you to test if the key is well recognized (this part is indicative to show how it works but is not essential).
And the last and most important part is the code to put in your program !
All the work is already done... you just have to:
- copy paste the part of the code on your program in the very first position (really at the top)
- don't forget to put your keys from the txt file on the variable mdp$
- then indicated the number of keys generated
and that's all ! once launched, you are asked for the code, if 3 tries are wrong, there is a security closure. If it's good, there will be no more future requests.
You keep the txt file for yourself and you have your database on the tnk file (admittedly it can be cracked but it already prevents 99.99% of abuse) From there you can sell your software. For each new software, you repeat the operation so as not to have the same keys
(the numbering of the keys here is really very basic. If you want more security you can add lowercase or uppercase letters as well as symbols)
if need the function :
As some know, I embarked on the adventure of making commercial games using LibertyBasic (yes it's not a joke ^^).
The main problem I encounter is the turnkey sale of one of my software or games. Indeed, other languages have the advantage of having third-party or directly integrated programs that allow you to request a software key activation to use the game or software. Out here, no, so everyone can give themselves the file and not get paid....it's annoying when it comes to professional work!
So I leaned on a program directly incorporated into the source code which would allow to have a security in order to be able to market its games or software quietly.
This is how "LibertyBasic Shield" was born!
The idea is simple, when you buy one of your software, you are asked for an activation code when you open it for the first time (Of course, you give it to the customer when you buy it and it must be different for each customer) .
Once he validates the code, a license file is created.
This will allow the customer not to have to give this code each time they open. The file created is unique per customer. It contains the license number. If this is modified, a message will state that the code is no longer valid. If it is deleted, the client will have to redo the operation. If the file is forwarded to someone, they will automatically have to forward the license number for it to work. So if a number is assigned to each customer, it is very easy to know who illegally transmitted your software!
The first part of the code generates a desired number of keys (the more you ask for, the longer it will take to generate... on average if you ask for 20,000, it takes 1-2 minutes). The keys are then saved in a text file.
The second part allows you to test if the key is well recognized (this part is indicative to show how it works but is not essential).
And the last and most important part is the code to put in your program !
All the work is already done... you just have to:
- copy paste the part of the code on your program in the very first position (really at the top)
- don't forget to put your keys from the txt file on the variable mdp$
- then indicated the number of keys generated
and that's all ! once launched, you are asked for the code, if 3 tries are wrong, there is a security closure. If it's good, there will be no more future requests.
You keep the txt file for yourself and you have your database on the tnk file (admittedly it can be cracked but it already prevents 99.99% of abuse) From there you can sell your software. For each new software, you repeat the operation so as not to have the same keys
(the numbering of the keys here is really very basic. If you want more security you can add lowercase or uppercase letters as well as symbols)
'************************************************************
' key Generator by Atomose studio (atomose.fr) *
' A easy way to protect your software for commercial use *
'***********************************************************
prompt "How many keys do you want to generate?";test$
keys = val(test$)
ligne$ = "";int(rnd(1)*8999999999999+1000000000000) ' first key for no space
print ""
print " ------------------------"
print " -- KEY GENERATOR 1.2 --"
print " ------------------------"
print ""
print " ";keys;" keys selected for creation"
print " Key generator is working pls wait ...(can take time)"
for x = 1 to keys-1
number = int(rnd(1)*8999999999999+1000000000000) : ligne$ = ligne$ ; " " ; number 'cryptage size, you can change it as well, bigger = safe
next x
open "key.txt" for output as #save : print #save ,ligne$ : close #save 'save keys on txt file for next users
print " Done!"
print ""
print " ************************"
print " * Key saved on key.txt *"
print " ************************"
print ""
'*************************************************************************
' ckeck exemple, this part is only here for check a key if you need it. *
'*************************************************************************
keyONfile$ = "7998305310340" ' this line is the user key. You can give him by email, and put it on the program with box
print " Selected key : ";keyONfile$
print " Pls wait for checking ..."
open "key.txt" for input as #keys : input #keys, sprites$ : close #keys ' load keys from txt file or by [key]...keys$... return
for s = 1 to keys
select case word$(sprites$,s)
case keyONfile$
print " key found on the list at position ";s;" !" : print "" : print " END PROGRAM ---" : wait ' when the good key found, put a unlock variable for program/game save file
end select
next
print " All key checked, no match with selected key" : print "" : print " END PROGRAM ---" : wait
'************************************************************************************
' This part is the code you have to put at the beginning of your code for security *
' you just have to copy ==> paste *
'************************************************************************************
dir$ = "" : file$ = "licence.atms"
if fileExist(dir$,file$) = 0 then NOlicence = 1
mdp$ = "" : keys = YOU MUST PUT THE KEYS FROM TXT FILE AND PUT THE NUMBER OF KEYS GENERATED
[re]
if NOlicence = 0 then open "licence.atms" for input as #licence : input #licence, mdpE$ : close #licence : goto [licence]
nESSAI = nESSAI + 1
prompt "Please enter your validation code : ";mdpE$
if mdpE$ = "" then end
[licence]
for s = 1 to keys
mdpSELECT$ = word$(mdp$,s)
if mdpE$ = mdpSELECT$ and NOlicence = 0 then goto [licenceOK]
if mdpE$ = mdpSELECT$ and NOlicence = 1 then open "licence.atms" for output as #licence : print #licence, mdpE$ : notice " " + chr$(13) + "Software unlock ! thx" : close #licence : goto [licenceOK]
next s
if nESSAI <= 2 and NOlicence = 1 then Notice " " + chr$(13) + "bad code !" : goto [re]
if NOlicence = 0 then notice " " + chr$(13) + "Code changed. Please retry or delete your licence file" : end
if NOlicence = 1 then notice " " + chr$(13) + "3 attempts failed. Please check your code activation." : end
[licenceOK]
if need the function :
function fileExist(dir$,file$)
dim info$(10, 10)
files dir$,file$, info$(
if val(info$(0, 0)) > 0 then
fileExist = 1
else
fileExist = 0
end if
end function