使用Scripting.Encoder加密VBS脚本

标签: , , , ,

我《VBS加密 & VBE解密》中提到过可以用Script Encoder来加密VBS脚本,但是不知为何,微软官方现在已经不提供Script Encoder的下载。当然,你可以到其他网站上去下载Script Encoder来加密VBS,如果你不怕中病毒的话。

其实不必如此麻烦,加密VBS的组件Scripting.Encoder默认就安装在我们的系统中,我们可以调用Scripting.Encoder对象的EncodeScriptFile方法来加密VBS脚本。

Option Explicit
Dim se, fso
Dim argv, file, str
'VBScript Encoder
'Author: Demon
'Website: https://demon.tw
Set se  = CreateObject("Scripting.Encoder")
Set fso = CreateObject("Scripting.FilesystemObject")
For Each argv In WScript.Arguments
    Set file = fso.OpenTextFile(argv)
    str = file.ReadAll
    file.Close
    str = se.EncodeScriptFile(".vbs", str, 0 , "")
    argv = Left(argv, Len(argv)-3) & ".vbe"
    Set file = fso.OpenTextFile(argv, 2, True)
    file.Write str
    file.Close
Next
MsgBox "OK", vbInformation

最后Demon奉劝大家不要以为把VBS加密成VBE就高枕无忧了,在高手面前,一切VBS加密都是浮云。

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. UTF-16与UCS-2的区别
  2. C语言函数strcpy strncpy和strlcpy
  3. Unable to find the socket transport "ssl" – did you forget to enable it when you configured PHP?
  4. 用JavaScript读写二进制文件的另一种方法
  5. 纯真IP数据库QQWry.dat格式详解

3 条评论 发表在“使用Scripting.Encoder加密VBS脚本”上

  1. kxmw.com说道:

    sce10en.exe是在CMD里面弄的 看着就头晕 不知道有没有更简单的

  2. su0说道:

    关注博主很多年了,至今还在受惠于博主许多年前的帖子,真的感恩,谢谢!!!! 博主真的是个宝藏!

留下回复