0

I want to create a trial version of a program for my customer. I want to give him/her some time to test the program (7 days in this case).

I have this command in the application (in *.py file):

 if os.path.isfile('some_chars.txt') or datetime.now()<datetime.strptime('30-8-2015','%d-%m-%Y'): 
# DO WHAT application HAS TO DO
else:
    print 'TRIAL EXPIRED'
    quit()

I'm curious whether is this approach enough for common customer or whether I have to change it. The thing is that the application has to find a file which name is, let's say, 'some_chars.txt'. If the file was found, the application works as it has to do, if not, it returns a text 'Trial version expired'.

So the main question is - is it enough for common customer? Can it be found somewhere or is it compiled to machine code so he would had to disassemble it?

EDIT: I forgot to mention very important thing, I'm using py2exe to make an executable file (main) with unnecessary files and folders.

Milano
  • 18,048
  • 37
  • 153
  • 353
  • What do you mean "is it enough for common customer"? What common customer? What's enough? Are you asking about security or functionality? Are you asking if 7 days is enough time? – Bobbyrogers Jul 28 '15 at 23:48
  • With license protection like that, you might as well use the honor system. If you personally know this customer, the honor system would probably work _better_ than a technical solution. – TigerhawkT3 Jul 28 '15 at 23:48
  • Compiled to machine-code? Not unless you are using some kind of python compiler. What files are you giving the customer? The .py file? – Blorgbeard Jul 28 '15 at 23:50
  • @Blorgbeard - "some kind of python compiler" - you mean the standard implementation, which automatically compiles a module into bytecode (.pyc) when you run a script that imports that module? – TigerhawkT3 Jul 28 '15 at 23:58
  • I've forgotten to mention very important thing - I use py2exe to make an executable file with unnecessary folders and files, – Milano Jul 29 '15 at 00:03
  • @Bobbyrogers No, I've elaborated my question. I've forgot to mention that I'm using py2exe to make it executable. – Milano Jul 29 '15 at 00:06
  • @Blorgbeard No, I've elaborated my question. I've forgot to mention that I'm using py2exe to make it executable. – Milano Jul 29 '15 at 00:06
  • @TigerhawkT3 No, I've elaborated my question. I've forgot to mention that I'm using py2exe to make it executable. – Milano Jul 29 '15 at 00:07
  • Since there is no option to answer everybody, I had to wrote the same comment to each of you – Milano Jul 29 '15 at 00:08
  • Don't quit() upon trial expired; no matter how much you save in "piracy" you'll lose in good will. Better to have many people using [guiltware](https://en.wiktionary.org/wiki/guiltware) copies than no one at all using it because it's rude. – msw Jul 29 '15 at 00:24
  • @TigerhawkT3 technically bytecode, not machine-code, but sure. – Blorgbeard Jul 29 '15 at 01:21
  • @Blorgbeard - yep, compiled into bytecode. – TigerhawkT3 Jul 29 '15 at 01:49
  • The only uncrackable license enforcement methods I know are running parts (or all) of the code on your server or running it on a physical dongle with a custom ASIC designed at transistor level to implement (parts of) the code and the licensing. – enobayram Jul 29 '15 at 02:52
  • @Milano What is your os ,I have an idea but it only works for windows. – Anonymous Apr 04 '19 at 09:36
  • The idea is pretty basic but it is very difficult to crack it and it provides ultra high security.Even programmers will have a tough time cracking it. – Anonymous Apr 04 '19 at 09:38

2 Answers2

1

Of course it has everything to do with the target (population) you're aiming: there are some cases when security is an offense (that involves lots of money so it's not our case);

Let's take an example:

  • Have a program that reads plain data from a file(registry,...); e.g. :the date (the program converts the date does a comparison and depending on the trial period close or lets the user go on)

  • Have everything from previous step, but the data is not in plain text, it is encrypted (e.g.: 1 is added to every char in the data so it is not immediately readable)

  • Use some well known encryption algorithms (would make the data unreadable to the user)

But, no matter the method you choose, it's just a matter of time til it will be broken.

A "hard to beat" way would be to have an existing server where the client could connect and "secretly talk" (I'm talking about a SSLed connecion anyway), even for trial period.

"Hiding the obvious info"(delivering a "compiled" .py script) is no longer the way (the most common Google search will point to a Python "decompiler")

CristiFati
  • 38,250
  • 9
  • 50
  • 87
0

Python is interpreted, so all they have to do is look at the source code to see time limiting section.

There are some options of turning a python script into an executable. I would try this and don't use any external files to set the date, keep it in the script.

Kim Ryan
  • 515
  • 1
  • 3
  • 11
  • I'm sorry, I've forgot to mention that I'm using py2exe which creates an executable. The file 'some_chars.txt' is an empty file which is some kind of flag which tells the application that the version is full. – Milano Jul 29 '15 at 00:13
  • OK then, if it's compiled they can' see the date in your code of 30 August unless they try really hard. The user could still move the system date forward to get around this, but it may be more trouble than it's worth to them. Another option is to just let them run the prgoram a maximum number of times, such as 15. – Kim Ryan Jul 29 '15 at 00:29