通過在vbs中使用Execute對數據進行加密,代碼如下:
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",2,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 j=1 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
使用方法:將需要加密的VBS腳本拖動到這個加密程序文件中即可實現加密。