VBS简介、实例(一)—— 整蛊小病毒

本文介绍了VBS(VisualBasicScript)的基本概念、代码模式,包括消息框、输入输出、运算功能以及如何创建无法关闭的窗口。还展示了整蛊代码实例,以及如何破解和防范此类恶作剧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

书写本帖时间:2024.2.22

First:什么是VBS?

                          

VBS是基于Visual Basic的脚本语言

VBS的全称是:Microsoft Visual Basic Script Edition。

应用场景:操作系统、网页浏览器、网页服务器。


Second:VBS的代码模式。

1.最简单的代码示意

Msgbox表示弹出一个窗口,()中的内容为窗口中的内容。

'此处为注释,不会运行
'请将代码保存为.vbs格式的文件
Msgbox(12345)

例如,如上代码运行起来如图1.1

​                                                                           

                                                                           图1.1 

2.输出输入框

Input()函数代表输入框

'VBS中,只能使用英语编写代码(不会英语的人,赶快去补习一下吧(doge)
Msgbox(Inputbox("Please enter password:"))

运行起来如图1.2所示

                                                                  图1.2

如果想要更加简便、可以多次使用效果,可以输入

password=Inputbox("Please enter password:")
Msgbox(password)
3.进行运算 
Dim a,b,c
a=inputbox("a is:","enter")
b=Inputbox("b is:","enter")
c=a*3+b*5
msgbox (c)

在这个运算模式下

c=a*3+b*5

输入a=1,b=2,可得输出结果为13.(如组图1.3、1.4、1.5所示)

                                                图1.3

                                             图1.4

                 图1.5                                                                   

                                                                                                  PS:可以替换成别的运算模式。

4.无法关闭的窗口

想要实现一个窗口无法关闭,就必须使用loop.

msgbox(12345)
loop

这样一个输出"12345"的弹窗就会不断打开,无法关闭。

5.VBS函数

这里有VBS的完整函数表,感兴趣或者需要的人可以查看一下.

不同的函数,运用在不同的地方。

VBScript_百度百科VBScript是Visual Basic Script的简称,即 Visual Basic脚本语言,有时也被缩写为VBS。它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。同时它又是asp动态网页默认的编程语言,配合asp内建对象和ADO对象,用户很快就能掌握访问数据库的asp动态网页开发技术。icon-default.png?t=N7T8https://baike.baidu.com/item/VBScript?fromModule=lemma_search-box

 6.综合演练——password验证实例。

首先,我们需要制作一个输入弹窗,以便输入密码。

a=inputbox("Password")

其次,我们需要实现验证,输入正确打开文件,输入错误无法进入。

if a=pass then
msgbox"RIGHT"
set ws=WScript.CreateObject("WScript.Shell") 
ws.Run "password.exe",0,true
exit do
else
if s=10 then
msgbox"ERR_510"
exit do
else
s=s+1
msgbox"FLASE"
end if
end if
loop

随后,我们来规定正确代码。

const pass="12345"
do

 完整代码:

dim a,s
s=0
const pass="12345"
do
a=inputbox("Password")'自己修改
if a=pass then
msgbox"RIGHT"
set ws=WScript.CreateObject("WScript.Shell") 
ws.Run "password.exe",0,true'更改为自己要打开的文件地址
exit do
else
if s=10 then
msgbox"ERR_510"
exit do
else
s=s+1
msgbox"FLASE"
end if
end if
loop

 Third: 整蛊代码

此整蛊代码需要准备两个.vbs文件

password.vbs与上方实例代码基本相同,不做过多演示,大家看一看即可。

dim a,s
s=0
const pass="12345"
do
a=inputbox("please enter password...")
if a=pass then
msgbox"RIGHT"
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Dim vbsFilePath
vbsFilePath = "max1.vbs"'此处可以修改为路径,例如"D:\VBS\max1.vbs" 
objShell.Run "wscript.exe " & vbsFilePath
Set objShell = Nothing
exit do
else
if s=10 then
msgbox"ERR_510"
Set objShell = CreateObject("WScript.Shell")
objShell.Run "shutdown -s -t 0", 0, True
exit do
else
s=s+1
msgbox"FLASE"
end if
end if
loop

max1.vbs源码(制造恐慌ing)

'无论怎样都会关机
'用来坑害好基友
X=msgbox("An unknown issue has occurred. Do you want to fix it?",3+16,"This computer")
X=msgbox("Fix problem failed",3+64,"This computer")
X=msgbox("Do you want to scan this computer?",4+32,"Windows Defender")
X=msgbox("Scanning...",2+64,"Windows Defender")
X=msgbox("Virus found, do you want to clear it?",4+48,"Windows Defender")
X=msgbox("Unable to clear this virus.",1+16,"Windows Defender")
X=msgbox("Unable to terminate virus process",0+48,"System")
X=msgbox("Uploading your hard drive content and password to the cloud",2+64,"Virus")
X=msgbox("Cannot abort this operation",0+16,"Virus")
X=msgbox("(ERR)Deleting system files...",1+16,"Virus")
X=msgbox("We have an irreparable and unstoppable issue!",1+16,"Virus")
X=msgbox("Cannot cancel this operation",0+16,"Virus")
set WSHshell=wscript.createobject("wscript.shell")
WSHshell.run"cmd /c""cd C:/&&cd Windows&&cd system32&&dir",4,ture
X=msgbox("Deleted system files successfully!",0+48,"Virus")
X=msgbox("Your computer's privacy has been compromised, saving failed",0+64,"Virus")
X=msgbox("Hahaha, look at how scared and teasing you are. Hurry up and scam other friends!",0+64,"Virus")
Set objShell = CreateObject("wscript.shell")
objShell.Run "shutdown -s -t 5", 0, True

运行效果:

破解方法:

打开任务管理器,结束wscript.exe进程即可

                                                   


                                                       本帖到这里就结束啦。

评论区对话或者私信【VBS】了解更多有关VBS的信息,我很乐意向你们分享经验。

如果你还在为代码编辑器的价格太过高昂而发愁,私信我,发送【破解】,了解更多破解信息。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值