(OT) lincense protection generator

Steven D'Aprano steve at REMOVEMEcyber.com.au
Thu Jun 2 23:59:25 EDT 2005


flupke wrote:
> Jarek Zgoda wrote:
> 
>> flupke napisał(a):
>>
>>> I'm thinking of a function that will generate such a code and put it 
>>> in a file. Then when the program starts it checks this file and 
>>> checks the code in there with a code that it generates at that time 
>>> again based for instance on the current directory and other 
>>> components unique to that computer. It could be a long string (but 
>>> what info?) and then take a hash from it and store the hash value.
>>
>>
>>
>> Better, generate sha1 sum of general machine configuration (i.e. what 
>> "set" command returns) and store it on random internet node. You can 
>> be sure nobody would get it.
>>
>> Anyway, it's bad idea. Restrict program usage in license) or any other 
>> contract), but don't do such a mess to people who pay your bills.
>>
> 
> Well as i said it's more to see when they tampered with the config or 
> the program. It's not a commercial application but it's for inhouse use 
> in the hospital where i work. These people are, to put it mildly, not 
> the most computer savant people around.
> It could be handy to avoid me searching for a solution to a problem that 
> arises because of messing with the setup rather than a bug in the code.

Log the program's errors.

If a config file isn't found, it will log that fact. If 
they edit a config file and change (say) num_widgets = 
5 to num_widgets = -88888, then when the program raises 
an exception it will log something like ValueError("Num 
widgets is less than zero").

This will also help catch your errors as well as their 
errors.


Alternatively, put a lot of error checking in one 
module which you import and run at startup. Something like:

try:
     import mymodule
     import databasemodule
except:
     print "PEBCAK error, call tech support"
     sys.exit(99)

and you will know they have moved things around.



-- 
Steven.




More information about the Python-list mailing list