Hi Experts,

I am working on the project that is going to be complate in some days.
I want to limit trial usage of program for 1 month.
I am succeded to do it. If trial period expired the program doesnt work and prints warning messages.

I want to add one more thing to the limitation. To put the function that will delete program itself (selfdestruct) from the directory when trial expiration date came.

I couldn't figure out how to do it.

Help/advice will be appreciated.

Thanks in advance.
Newbie in Phyton
Adam.

That is a piece of logic here.
1. You create your app
2. You create another script to execute if the time for purchasing your app has reached.
that is..................

if time > time_to_reg:
   destroyapp()

The you have the method destroyapp() coded to remove the files and other stuffs. Hope you got the idea.

Bear in mind that if the user can see the code in the 'master' script, they can alter it. Obfuscation only works if the user is naive. And think about when the cutoff time is set: If it is done as part of the installation, then the user merely reinstalls to get another trial period, so you probably want them to download the app with the cutoff date inserted at download time. Or, if the app can reasonably be expected to interact with the network, you can have it 'call home for permission' sending a hash of, maybe, the hardware UUID. First time puts a timestamp in your database, subsequent calls get permission only until the trial time is up. Buying a 'full service' key installs the key into the code in place of the 'call home' function.

That is a piece of logic here.
1. You create your app
2. You create another script to execute if the time for purchasing your app has reached.
that is..................

if time > time_to_reg:
   destroyapp()

The you have the method destroyapp() coded to remove the files and other stuffs. Hope you got the idea.

I think you are right. I should create one more application that will call main program unless the time has not expired.

If use_date<expire_date:
   main_application()
else:
   print "End of expiration of trial"
   destroyapp()

Thank you very much for reply.
Adam

Bear in mind that if the user can see the code in the 'master' script, they can alter it. Obfuscation only works if the user is naive. And think about when the cutoff time is set: If it is done as part of the installation, then the user merely reinstalls to get another trial period, so you probably want them to download the app with the cutoff date inserted at download time. Or, if the app can reasonably be expected to interact with the network, you can have it 'call home for permission' sending a hash of, maybe, the hardware UUID. First time puts a timestamp in your database, subsequent calls get permission only until the trial time is up. Buying a 'full service' key installs the key into the code in place of the 'call home' function.

You are certainly right griswolf. How should be the function that will work as "call home"? I mean, the code. Do we have ready-to-use module in python?

Thanks for advice in advance.
adam.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.