简体   繁体   中英

Is it a good idea to protect a exe file using os.path.exists?

Is it a good idea to use:

import os.path
os.path.exists (file_path)

to "protect" a program against copies?

For example, in our main application, we use:

import os.path
os.path.exists ("c:\windows\mifile.dll")

where mifile.dll is anything, of course with another name like windriv.dll and just a simple text saved with Notepad.

If the file exists the program works, if not then it displays a warning message that it's a illegal copy or something.

When installing the program, I do the normal installation of the package or the portable folder and manually copy the file mifile.dll in c:\\windows .

This isn't the best idea.

  1. A lot of people (such as myself and possibly virus programs) watch the windows directory and would delete something like this.
  2. This kind of thing might be better to be encrypted
  3. Catching an import error isn't the easiest thing
  4. If you are worried about illegal copies it wouldn't be long until somebody figured this out and you have a file that can be copied easily and distributed easily.
  5. Using an import and erroring out would be a huge red flag to a reverse engineer
  6. With UAC this file might not be accessible without running the program as an administrator

No.

Whichever solution you end up with, the general idea of a "secret handshake install technique" is basically sabotage . You are effectively preventing your customers from:

  • Upgrading the OS of the machine
  • Restoring their system from a backup
  • Moving your service to a new machine because of hardware failure

The customer will need to do either of these within the next few years. When they do, your program will break, and they will not know why or how to fix it. Given that you are even available to them at this time, think of how this makes you look when they contact you to fix the issue.

If I found out that a subcontractor had secretly introduced themselves as a single point of failure like this, I would be bloody furious.

Either trust your customers, get new customers that you can trust, or go for a fully professional non-secret DRM solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM