将 .hta 文件编译为 .exe
我广泛搜索了一种将 .hta 文件(和资源)编译为 .exe 文件的方法。
有很多应用程序声称能够做到这一点 - 但它们并没有适用于这个应用程序 - 这是 javascript 和 VB 的混合体。
简单地说,(天真地)我不希望人们查看/修改代码。任何建议或解决方案将不胜感激。
编辑:当然,我知道 javascript 和 VB 不是“可编译的”,因为它们是解释性语言。我只是在寻找一种真正隐藏来源的方法。
I have searched far and wide for a way to compile my .hta file (and resources) to a .exe file.
There are plenty of applications that claim to be able to do this - but they have not worked for this application - which is a mixture of javascript and VB.
Simply, (and naively,) I don't want people looking at / screwing with the code. Any suggestions or solutions would be greatly appreciated.
EDIT: Of course, I understand that javascript and VB are not "compilable" since they are interpreted languages. I am just looking for a way to truly hide the source.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以通过简单地将 HTA 包装到知道如何设置 HTA 上下文/窗口的可执行文件中来“编译为 exe”。
最简单的方法(听起来像 ExeScript)是先提取 HTA/资源,然后执行它们。理论上,无需临时文件,就可以通过将数据注入正在运行的 IE 上下文来完成此操作,但任务变得更加困难。内部 JS 可能会或可能不会被混淆,并且包装器可能会或可能不会添加额外的混淆/“加密”层。 (PayMo,我相信还有其他公司,使用包装上下文方法来分发单个可运行的 exe)。
如果保护“知识产权”是目标,请聘请一位好律师:-)
You can "compile to exe" by simply wrapping the HTA into an executable which knows how to setup the HTA context/window.
The most trivial approach (which sounds like ExeScript) is to simply extract the HTA/resources first and then execute them. One could theoretically do this without temporary files by injecting data into a running IE context, but the task becomes more difficult. The internal JS may or may not be obfuscated and the wrapper may or may not add an additional layer of obfuscation/"encryption". (PayMo, and I am sure there are others, uses a wrapped context approach to distribute a single runnable exe).
If protecting "intellectual property" is the goal, hire a good lawyer :-)
我不确定是否编译为 exe - 但如果你缩小 &混淆你的源代码,除非你有一些非常有价值的东西,否则逆向工程将是一项艰巨的工作。
http://developer.yahoo.com/yui/compressor/
祝你好运。
I'm not sure about compiling to an exe - but if you minify & obfuscate your source code, unless you've got something incredibly valuable, it'd be a huge job to reverse-engineer.
http://developer.yahoo.com/yui/compressor/
Good luck.
你不需要编译器,你需要一个加密器/解密器,就像我的项目(正在建设中),CFS项目(Cryptographya File Security)。
You don't need a compiler, you need an encryptor/decryptor, like my project (under construction), the CFS project (Cryptographica File Security).
我的线索是创建 VBScript 或 JScript 文件,以便动态生成 HTA。所以你编译的不是 HTA,而是脚本。这种方法比 HTA 打包到 SFX 更好地满足您的安全要求。
首先准备资源 - 将所有外部文件导入到 HTA:脚本、样式表和图像(base64 编码),以使您的 HTA 独立应用程序。然后创建例如 VBScript 文件,并将所有 HTML 内容从 HTA 复制到脚本中的字符串变量,将换行符和制表符替换为
" & vbCrLf & "
和" & vbTab & "
.添加代码动态创建 HTA 窗口,.write()
将该字符串变量写入窗口的文档,然后退出脚本。请注意,由于将内容推送到已经加载的窗口,
Window_OnLoad()
可能无法正常工作。然后将完成的 VBScript 加密为 exe(使用真正的加密实用程序,例如 Primal Script 2012、ExeScript、VbsEdit 或 ScriptCryptor)。并使用 PE Explorer 更改图标。
所有这些都需要一些时间,但值得做。
UPD:这是通过链接准备的脚本示例。
My clue is to create VBScript or JScript file for HTA to be dynamically spawned by. So you compile not HTA, but the script. This approach meets your security requirements much better than HTA packed to SFX.
Prepare the resources first - import to HTA all external files: scripts, stylesheets, and images (base64-encoded), to make your HTA standalone app. Then create eg VBScript file, and copy all HTML content from your HTA to the string variable in the script, replacing new line and tab symbols to
" & vbCrLf & "
and" & vbTab & "
. Add code to create HTA window dynamically,.write()
that string variable to the window's document, and quit script.Note that
Window_OnLoad()
may not work properly due to pushing the content to window, that was already loaded.Then just encrypt your completed VBScript to exe (using true encrypting utility, eg Primal Script 2012, ExeScript, VbsEdit or ScriptCryptor). And change icon with PE Explorer.
All that will take some time, but it is worth doing.
UPD: Here is an example of prepared script by the link.
与 VBSedit 捆绑在一起的 HTAEdit 并没有真正隐藏 hta 代码。在运行时,它将原始 hta 文件提取到 %temp% 中的子目录中,并将其传递给 mshta.exe 来执行。据我所知,由 VBSedit 创建的转换后的 exe 似乎并没有这样做。
HTAEdit, which comes bundled with VBSedit, does not truly hide the hta code. At run time, it extracts the original hta file to a subdirectory in %temp% and passes it off to mshta.exe to execute. The converted exe's created by VBSedit don't seem to do this as far as I can tell.
尝试使用 VBSedit,它绝对可以将 vbs 和 hta 转换为 exe
Try using VBSedit, it definitely works for converting both vbs and hta to exe