防止 EXE 被复制到另一台 PC - 在 EXE 文件中保留一些信息(例如某些标志) [英] Prevent EXE being copied to another PC - keep some info inside EXE file (e.g. some flag)

查看:23
本文介绍了防止 EXE 被复制到另一台 PC - 在 EXE 文件中保留一些信息(例如某些标志)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想防止将可执行文件复制到另一台 PC 上,因此我需要以某种方式在我的 EXE 文件中保存有关它已在另一台 PC 上的其他地方使用的信息.

I want to prevent executable being copied to another PC and thus i need to somehow save information inside my EXE file about that it was already used somewhere else on another PC.

我可以在我的 EXE 文件中嵌入一小段信息,例如用户的硬盘驱动器编号,以便在将此 EXE 复制到另一台 PC 时可以使用这些信息吗?

Can i embed small piece of information like user's hard drive number into my EXE file so this information would be available when this EXE is copied to another PC?

我想也许有一种方法可以读取和写入嵌入在 EXE 文件中的某些资源文件,但我认为资源文件是只读的,如果是这样,EXE 文件中是否有一个地方可以保存我的信息需要吗?

I thought maybe there is a way to read and write to some resource file embedded in an EXE file but i presume that resource file is read only and if so is there is a place inside EXE file where i could keep information which i need?

推荐答案

好的,我分析了所有提议的变体,并决定在我的情况下开发自己的版权保护系统会更好,原因是我是一名独立开发人员,不会使用超大型应用程序.

Ok, I analyzed all the variants that were proposed and decided that in my case it will be better to develop my own copy-protection system, due to the reason that I am an indie developer and not going to work with extra large applications.

以防万一,有人面临同样的问题 - 这是算法(好吧,其中之一):

Just in case, somebody faces to the same issue - here is the algorithm (well, one of them):

  1. 用户启动APP1.EXE
  2. APP1.EXE 将自身读取到某个变量并在其末尾添加硬盘序列号,例如硬盘序列号 - 当您在末尾添加内容时,它不会破坏 EXE 文件,您不必担心 PE 标头
  3. 不幸的是,EXE 无法在运行时保存自身,因此它保存了名为 APP2.EXE 的副本,其中包含有关 HDD 的信息
  4. 当保存 APP2.EXE 时,APP1.EXE 通过 Process.Start() 将其作为一个单独的进程启动并自行终止
  5. 现在APP2.EXE正在运行,内容与APP1.EXE+硬盘序列号相同,所以我们只需将APP2.EXE中的所有字节写回APP1.EXE,关闭当前进程并再次启动APP1.EXE
  6. 从现在开始,APP1.EXE 正在运行并拥有有关当前 HDD 的所有所需信息,因此每次用户启动 APP1.EXE 时,它都会将其内容末尾的 HDD 编号与用户 PC 上的实际编号进行比较,如果它们不同 - 终止过程
  7. 删除 APP2.EXE,以免用户意识到这些文件如何交换有关其硬盘的信息.

可以在此处找到有关自删除 EXE 的有用信息:

Useful info about self-deleting EXE can be found here :

P.S. 我知道这就像一个巨大的安全漏洞(我不会提到所有的漏洞)但是这个算法的实现只用了 20 行 C# 代码,并被转移到一个单独的 DLL 中,我可以在任何地方使用它并且它可以工作.上面的算法没有任何注册,用户可以简单地拿这个应用程序并使用它,我相信大约 80% 的人不会意识到这个应用程序是如何防止复制的.

P. S. I know that it is like a huge hole of security (I will not mention all of them) but implementation of this algorithm took just 20 lines of code in C# and was moved to a separate DLL which I can use everywhere and it works. There is NO any registration in the algorithm above and user can simply take this app and use it and I am sure that ~ 80% of them will not realize how this app is protected from copying.

实施链接:https://bitbucket.org/artemiusgreat/examples/src/ef7b60142277?at=master

这篇关于防止 EXE 被复制到另一台 PC - 在 EXE 文件中保留一些信息(例如某些标志)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆