可以修改脚本自身运行次数的vbs(Self modifying script)
程序员文章站
2022-07-06 12:58:30
this script behaves like a virus this script shows you how a script can be self modify...
this script behaves like a virus
this script shows you how a script can be self modifying, like viruses.
it is a warning about the possibilities of macro viruses.
file name : selfmodify.vbs
requirement : none
author : jean-luc antoine
submitted : 01/09/2001
category : other
const n = 1
dim f, a, s, w
w = wscript.scriptfullname
set f = createobject("scripting.filesystemobject")
set a = f.opentextfile(w, 1)
a.skipline
s = chr(13) & chr(10) & a.readall
a.close
set a = f.createtextfile(w, true)
a.write "const n = " & n + 1 & s
a.close
wscript.echo "this script has been run " & n & " times"
原理就是每次运行脚本自身的代码就会被修改const n = 1,这个1是一直变化的。
原文:
this script shows you how a script can be self modifying, like viruses.
it is a warning about the possibilities of macro viruses.
file name : selfmodify.vbs
requirement : none
author : jean-luc antoine
submitted : 01/09/2001
category : other
复制代码 代码如下:
const n = 1
dim f, a, s, w
w = wscript.scriptfullname
set f = createobject("scripting.filesystemobject")
set a = f.opentextfile(w, 1)
a.skipline
s = chr(13) & chr(10) & a.readall
a.close
set a = f.createtextfile(w, true)
a.write "const n = " & n + 1 & s
a.close
wscript.echo "this script has been run " & n & " times"
原理就是每次运行脚本自身的代码就会被修改const n = 1,这个1是一直变化的。
原文:
上一篇: VBS 十六进制异或加密实现代码
下一篇: VBS 正则判别素数(质数)