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

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是一直變化的。

更多信息請查看IT技術專欄

更多信息請查看腳本欄目

2026國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網