可以修改腳本自身運(yùn)行次數(shù)的vbs(Self modifying script)
來源:易賢網(wǎng) 閱讀:1469 次 日期:2014-05-09 16:37:28
溫馨提示:易賢網(wǎng)小編為您整理了“可以修改腳本自身運(yùn)行次數(shù)的vbs(Self modifying script)”,方便廣大網(wǎng)友查閱!

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"

原理就是每次運(yùn)行腳本自身的代碼就會(huì)被修改Const n = 1,這個(gè)1是一直變化的。

更多信息請查看IT技術(shù)專欄

更多信息請查看腳本欄目
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn)

版權(quán)所有:易賢網(wǎng)