views:

49

answers:

3

hello . I'm searching for a way to generate a (limited time license) .so when a user starts the program . it has to check license date first before the program runs.
but the problem is :
i tried a couple of solutions . one of them is python's time.ctime , (to check time and see if it's realy during the license time) and it returns the time of the machine, so whenever a user want to use software without license he'll just change time of the machine.

i hope the idea is clear enough

any better ideas?


please inform me if you want more explanation

+1  A: 

You could get the time from an external source via Internet: http://stackoverflow.com/questions/908550/python-getting-date-online

Of course, this will only work if the user doesn't block your program from accessing the internet. And what should your program do when it can't access the internet? Refuse to run? I doubt that this is a good idea.

Tim Pietzcker
A: 

Nearly every standard function will return the machine time that can be adjusted by the user.

One possibility is to call a web service that returns the "correct" time. But this is only possible if you can assume internet access.

And may be should ask your self the question if that hassle is really worth the effort?

dmeister
+2  A: 

Regardless with the question whether or not this hassle is really worth the effort, you can check access times of ubiquitous files (e.g. /etc/passwd in Linux) and compare these to the current date. If you see that the files have been accessed/modified in the future, you know that there is a problem. Again, at least in *nix, a user may substitute system's stat, so that it "massages" the info you are looking at.

bgbg
im using windows64 . is it possible to do that over windows?
Moayyad Yaghi
Well, `os.stat(filename).st_atime` gives you the date/time of the most recent access of `filename`, and this works on Windows, too. But as soon as you access a file with a past date, that date will then overwrite whatever content was there first. So the user just needs to find out what file's stats you're accessing, look at it, and on the next run this protection is defeated.
Tim Pietzcker