Ці добрая ідэя абараніць exe-файл з дапамогай os.path.exists? (Is it a good idea to protect a exe file using os.path.exists?)


問題描述

Ці добрая ідэя абараніць exe‑файл з дапамогай os.path.exists? (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.

‑‑‑‑‑

參考解法

方法 1:

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

方法 2:

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.

(by fedetekauser1877337Deestan)

參考文件

  1. Is it a good idea to protect a exe file using os.path.exists? (CC BY‑SA 3.0/4.0)

#exe #Python #file






相關問題

lauch4j 你好世界程序 (lauch4j hello world program)

在具有提升權限的自己的目錄中啟動 .exe (Launching .exe in its own directory with elevation priviledges)

Я запампаваў файл .exe, але ён хутка зачыняецца пры адкрыцці (I've downloaded an .exe file but it closes quickly as it opens)

Ці добрая ідэя абараніць exe-файл з дапамогай os.path.exists? (Is it a good idea to protect a exe file using os.path.exists?)

如何將我的 Java 程序轉換為 .exe 文件? (How can I convert my Java program to an .exe file?)

有沒有辦法從 firefox 和 chrome 啟動 exe 應用程序 (Is there a way to launch exe application from firefox and chrome)

打開 .jar 文件時發生 java 異常 (a java exception has occured while opening .jar file)

錯誤,不運行程序(Windows) (error, not run program (windows))

如何從LabVIEW上編寫的應用程序(Exe)將數據返回到命令行界面? (How to return data to Command line Interface from Application (Exe) written on LabVIEW?)

pyinstaller --onefile 不會復制必要的文件 (pyinstaller --onefile doesn't copy necessary file)

系統找不到指定的路徑 - 批處理到exe (The system cannot find the path specified - batch to exe)

使用另一個 Python 文件的主 Python 文件(我想轉換為 .exe) (Main Python File Using Another Python File (I Want To Convert To .exe))







留言討論