Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement encryption in VBS

Shulou Source: shulou.com Published: 2022-06-03 06:53:08 09月25日 Update

Editor to share with you how to achieve VBS encryption, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

The encryption of that virus yesterday was really scary. I was not a master and could not write such advanced encryption. But inspired by the first layer of encryption of the virus, it is not difficult to carry out simple encryption. Of course, this low-level encryption can only be used to deceive some junk antivirus software. VBS scripts that use msxml2.xmlhttp and adodb.stream objects can easily be regarded as viruses by antivirus software. Students who do not know the truth will not dare to run them as soon as they see the virus report. After simple encryption, you should be able to bypass the more junk antivirus software.

The following is the encryption program, the principle is very low-level, read all the code of the source file and calculate the ASC value to write, Execute with Chr restored code.

The code is as follows:

On Error Resume Next

Set argv = WScript.Arguments

If argv.Count = 0 Then WScript.Quit

Set fso = CreateObject ("scripting.filesystemobject")

With fso.OpenTextFile (argv (0), 1)

Data = .ReadAll: .close

End With

With fso.OpenTextFile (argv (0) & ".txt", 2Jing True)

.WriteLine "data=" & Chr (34) & ASCdata (data) & Chr (34)

.WriteLine "Function ChrData (Data)"

.WriteLine "MyArray = Split (Data,", ",-1,1)"

.WriteLine "For each OldData in MyArray"

.WriteLine "Newdata=NewData" & Chr (38) & "chr (OldData)"

.WriteLine "Next"

.WriteLine "ChrData=NewData"

.WriteLine "End Function"

.WriteLine "execute Chrdata (data)"

.Close

End With

MsgBox "OK!", "Encrypt"

Function ASCdata (Data)

Num=len (data)

Newdata= ""

For juni1 to num

If j=num then

Newdata=newdata&asc (mid (data,j,1))

Else

Newdata=newdata&asc (mid (data,j,1)) & ","

End If

Next

ASCdata=newdata

End function

How to use it: drag the VBS script that needs to be encrypted directly to the encrypted program file, and the txt file of the encrypted script will be automatically generated.

The above is all the contents of the article "how to encrypt VBS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Encryption code antivirus software articles scripts software low-level content garbage files viruses programs terror advanced not so usage principles classmates most objects Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft vpn Linux Apple