Method of Protection software

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

English//

Hi, :)
Which are the best solutions to protect its application ?
It is possible to know the serial numbers to make a single key with PureBasic.
A serial number which doesn't change with each formatting, is this possible?

What is necessary it to employ like method?




French/Français
Salut, :)
Quels sont les meilleures solutions pour protéger son application ?
Est il possible de savoir les numéros de série pour faire une clef unique avec PureBasic.
Un numéro de série qui ne change pas à chaque formatage, est ce possible ?
Que faut il employer comme méthode ?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

There are several ways to do this...

You can provide a key to unlock the program & save it in the registry or on a file to generate the key you can use the HD serial, or the name of the computer....

There are other ways... internet registration... where you connect to a site & retrieve a particular file....

It's really up to you to come up with a clever way...


--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

I think that I will use a key starting from the number of the hard disk.
But with each formatting the number of the hard disk changes.:cry:
There is you a number who does not change ?
One needs a key which is always the same one on the same PC
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
There is you a number who does not change ?
One needs a key which is always the same one on the same PC
Maybe BIOS is the answer but i dont know how to access it from PB. Can anybody help in this point?

The second step, once you get a unique number that dosent change, you need to find a way that you key can not be cracked otherwise crckers will develop a keygen for your app.

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Every hardware-dependent number can change...
My Motherboard just went dead, and I got a new one.
I am very glad, that none of the Programs I own check the Bios Number

I think the Keyfile is the best way to go.

> you need to find a way that you key can not be cracked otherwise crckers will develop a keygen
> for your app.

Everything can be cracked. Even if the checks are hardware-dependent, the crackers can still
edit your exe-file, and remove all check procedures.

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

Yes, but I think that only orders crackers can make a keygen.
The problem, it is to succeed in reading a single number which does not change after each formatting, which is unpleasant for the heavy user and to be managed.
The solution of the serial number of the mother card is the best one, but how obtain it!
PS:sorry for my english
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Voldemort.
But with each formatting the number of the hard disk changes.:cry:
I'm using the size, and not the serial number, of the HD, since no two HDs really have the same exact size. That way, the user can reformat as often as they like, without worrying that my app won't work. If they repartition their drive it won't work, but that's unlikely to happen as often as a reformat.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

Yes, but the problem is that if some user get how do you generate you Keys then he can make a keygenerator and distribute it from many crack sites.
Then, the Key for every PC based on some ID its a good idea, but its neccesary to find some way to make more difficult the possible way to make a keygen.
Maybe in this area other users can help with they knowledge.

My idea is:

1.- The cracker can decompile or open you software in an hex editor and check directly how did you app generate the Key or check if the Key is right.
The best step to difficult this is to compact you executable and use some method that its a little more difficult than UPX since UPX is freely available. I know that no protection is imposible to crack, but let make more difficult to crackers.

2.- Find a way that you executable detects if some 'debug' software (SoftIce) is running on the PC and if it is then quit your application.
This kind of tools could show step by step (its a debbuger!) what your application is doing... then the cracker cn know how did you generate or check the Key.

NOW:

Can somebody say us if they know some way to do this 2 steps or if something is missing.

I know that some guys says that its better to give a featured-disable executable as the trial version. But how ever some people can get the full version and distribute it.
Imagine that you are working with an automated sale system that dont let you make an special compilation for every registered user since you are saling maybe 40 or 50 applications/day.

Without making a discussion, but contributing to find the best way can others give their opinions?

(Sorry for my horrible english!!)




Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

If found this code (was for VB and i ported to PB) to detect SoftIce

Code: Select all

;\\We break up the class names to avoid
;     detection in a hex editor
sRegMonClass.s  = "R"  + "e"  + "g"  + "m"  + "o"  + "n"  + "C"  + "l"  + "a"  + "s"  + "s"
sFileMonClass.s  = "F"  + "i"  + "l"  + "e"  + "M"  + "o"  + "n"  + "C"  + "l"  + "a"  + "s"  + "s"
;\\See if RegMon or FileMon are running
Debug FindWindow_(sRegMonClass, "")
Debug FindWindow_(sFileMonClass, "")
;Check for SoftIce in memory

Debug hFile  = CreateFile_("\\.\SICE", #GENERIC_WRITE Or #GENERIC_READ, #FILE_SHARE_READ Or #FILE_SHARE_WRITE, 0, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL, 0)

If hFile   - 1
  retVal  = CloseHandle_(hFile)
  End ;Close my software too
EndIf

;Check for SoftIce on NT, 2000, etc.

Debug hFile  = CreateFile_("\\.\NTICE", #GENERIC_WRITE Or #GENERIC_READ, #FILE_SHARE_READ Or #FILE_SHARE_WRITE, 0, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL, 0)

If hFile   - 1
  retVal  = CloseHandle_(hFile)
  End ;Close my software too
EndIf
I dont have SoftIce, can anybody test it please?

Note:

I found a page with ASM m ethods to detect WinIce and SoftIce

with codes like:

Code: Select all


    mov     ebp, 04243484Bh        ; 'BCHK'
    mov     ax, 04h
    int     3       
    cmp     al,4
    jnz     SoftICE_Detected

http://www.crackstore.com/003.htm

Then... maybe its possible to write a library with some of this routines so it could be easir to add it to executables.

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Max..
Originally posted by Julien Morel

I think that I will use a key starting from the number of the hard disk.
But with each formatting the number of the hard disk changes.:cry:
There is you a number who does not change ?
One needs a key which is always the same one on the same PC
Currently I'm working on a code that lets you retrieve the serial nummer of the harddisk's firmware as a side effect (maybe there is an easier way to get it, but as I said: a sideeffect I did not look for). That number does not change.

I hope I will have it up in a few days when my schedule allows it.

Max.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

For the moment I make with the size of the hard disk. But I cannot how
obtain it in KB Here the d?t code (the remainder I do not find)
I have evil with the DLL
Which can help

OpenLibrary(1,"kernel32")

CallFunction(1, "GetDiskFreeSpaceA","c:\",lpSectorsPerCluster.l,lpBytesPerSector,lpNumberOfFreeClusters,lpTotalNumberOfClusters)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

Make more checks.

For example the Windows-Key is saved in the regestry. Also the default username, etc.

The best solution:

Make a open Demo-Version (IMPORTANT: the restricted function should not deaktiveted, they should removed complete! with a #constant and compilerif #constant , compilerendif #constant. so you can't easy create a demo and a full-version.

So when somebody what to buy you software, create a exe with a induvidual s/n. and save the S/N and the user name.

So if you found a open downloadlink you know, who is respossible for this. The S/N should be hide more than more than one times in the code
(for example so
goto afterkey1
data.s "key"
afterkey:
)

Also, if you have a free update-system, you can say, that this "open"-s/n is not more updateable (or if the are diffrent s/n in the exe). in this case make a downgrade to the demo-version :wink: or the "updated"-exe should they after a short time "Error, please conntact the editor!".
Maybe it is funny to see, who all use a blackcopie :wink:

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.
Originally posted by GPI

Make more checks.

For example the Windows-Key is saved in the regestry. Also the default username, etc.

The best solution:

Make a open Demo-Version (IMPORTANT: the restricted function should not deaktiveted, they should removed complete! with a #constant and compilerif #constant , compilerendif #constant. so you can't easy create a demo and a full-version.

So when somebody what to buy you software, create a exe with a induvidual s/n. and save the S/N and the user name.

So if you found a open downloadlink you know, who is respossible for this. The S/N should be hide more than more than one times in the code
(for example so
goto afterkey1
data.s "key"
afterkey:
)

Also, if you have a free update-system, you can say, that this "open"-s/n is not more updateable (or if the are diffrent s/n in the exe). in this case make a downgrade to the demo-version :wink: or the "updated"-exe should they after a short time "Error, please conntact the editor!".
Maybe it is funny to see, who all use a blackcopie :wink:

Edit: also important: Why the programm checks, that he is a blackcopie: DON'T SAY THIS THE USER. The first time, the programm should work whell. but then it sould give error-messages, say, that he can't save or load, delete the actual work in the memory, and so on. Also this should be activate randomly, so it don't be so easy to see as a copy-protection. When a hack don't know, that there is a copy-protection, he will not search for it.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

First of all, you can use the API function directly:

UPDATE: the data will be in the variables after the function call succeeds (BTW, that french forum returns 404?).

Code: Select all

SectorsPerCluster.l
BytesPerSector.l
NumberOfFreeClusters.l
TotalNumberOfClusters.l

If GetDiskFreeSpace_("c:\", @SectorsPerCluster.l, @BytesPerSector, @NumberOfFreeClusters, @TotalNumberOfClusters)=0
  ErrorBuffer$ = Space(1024)
  FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError_(), 0, ErrorBuffer$, Len(ErrorBuffer$), 0)
  MessageRequester("Error", "GetFreeDiskSpace_() failed:"+Chr(10)+Chr(10)+ErrorBuffer$, 0)
EndIf

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Julien Morel.

and... how you do to turn over the value in KO, I do not understand how functions this dll
Post Reply