所以我的Excel-VBA项目密码很容易被破解...还有什么其他选择?
现在我知道有一个 简单的解决方法到标准方法<关于锁定和密码保护 VBA 代码,我想继续讨论更有效的代码保护方法。 我要向客户提供基于 Excel 的工具,但我想要的不仅仅是简单的烦人型保护,这种保护只会阻止最懒惰的黑客。
Excel-VBA 中是否有任何选项,或者我们真的必须编译一个单独的应用程序并忘记我们基于 Excel 的界面吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最简单、最有效的方法是将 VBA 代码移至 VB6 编译的 Com/automation 插件。
或者,如果性能不重要,您可能需要考虑 .Net(带有混淆器)解决方案。
The easiest and most efficient way is to move your VBA code to a VB6 compiled Com/automation addin.
Or you may want to consider a .Net (with obfuscator) solution if performance is not important.
实际上,VBA 混淆器不会保护 VBA 代码,因为它们保持算法的结构不变,可以追溯到可以恢复的原始算法。
将 VBA 代码转换为 VB6 意味着您的应用程序将仅限于 32 位 Excel(VB6 没有 64 位版本),并且可以通过 VB 反编译器(例如 https://www.vb-decompiler.org/
将您的VBA 代码转换为 VB.NET也不是一个完美的解决方案,因为.NET有一个“反射”机制,可以将.NET程序集的编译代码转换为原始源代码。
您可以将VBA代码转换为C/C++,这将是一种非常有效的保护形式,但由于C/C++和VBA是非常不同的编程语言,因此将VBA代码转换为C/C++是困难的、容易出错的,并且通常不值得花费大量的时间和精力。
有一个名为 VbaCompiler for Excel (http://vbacompiler.com) 的工具,可以将将VBA代码转换为C语言代码,然后将其编译成DLL。 该工具声称提供的保护级别类似于将 VBA 代码转换为 C/C++ 的保护级别,但无需执行此过程所需的大量手动工作。
Practically, VBA obfuscators do not protect VBA code because they leave the structure of the algorithm unchanged, which can be traced back to the original algorithms which can then be recovered.
Converting your VBA code to VB6 means your application will be limited to 32bit Excel (VB6 doesn’t have a 64-bit version) and it can be decompiled by VB decompilers such as https://www.vb-decompiler.org/
Converting your VBA code to VB.NET isn't a perfect solution either, as .NET has a ‘reflection’ mechanism which can convert the compiled code of .NET assembly into the original source code.
You can convert your VBA code to C/C++, which would be a very effective form of protection, but since C/C++ and VBA are very different programming languages, the conversion of VBA code to C/C++ is difficult, error prone, and generally not worth the huge amount of time and effort that it takes.
There is a tool called VbaCompiler for Excel (http://vbacompiler.com) which converts the VBA code to C language code and then compiles it into a DLL. The level of protection this tool claims to provide is similar to that of converting your VBA code to C/C++ but without the massive amount of manual work that is required for such a process.
另一个技巧是针对 Access 中的 Excel 对象编写代码,然后将访问文件放入 .mde
http://www.blog.methodsinexcel.co.uk/?s=访问+MDB
贫穷,但便宜;-)
Another Trick is to write the code against a excel object in Access then make the access file in to a .mde
http://www.blog.methodsinexcel.co.uk/?s=Access+MDB
Poor, but cheep ;-)
无需转换为另一种语言 - 您应该能够通过 www.vbsobfuscator.com [注:链接至 archive.org]
No need to convert to another language - you should be able to obfuscate most of your VBA code through www.vbsobfuscator.com [Note: Links to archive.org]