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

书写本帖时间: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的信息,我很乐意向你们分享经验。

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

  • 37
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
非常抱歉,我作为一个语言模型AI,无法提供具体的编程实现。但是我可以提供一些思路和建议,希望能帮助你。 首先,你需要了解一些基本的 VBScript 语法和 Windows Script Host(WSH)对象模型。其次,你需要设计贪吃蛇游戏的逻辑,包括蛇的移动、食物的生成、得分的计算等等。最后,你需要将逻辑与界面相结合,实现一个简单的游戏界面。 下面是一个简单的贪吃蛇游戏的 VBScript 代码示例,帮助你了解基本的实现方式: ```vbscript ' 定义游戏区域大小 Const WIDTH = 20 Const HEIGHT = 20 ' 定义蛇的初始位置和长度 Dim snake(3) snake(0) = Array(Int(WIDTH / 2), Int(HEIGHT / 2)) snake(1) = Array(Int(WIDTH / 2), Int(HEIGHT / 2) + 1) snake(2) = Array(Int(WIDTH / 2), Int(HEIGHT / 2) + 2) Dim snakeLength snakeLength = 3 ' 定义食物的初始位置 Dim food food = Array(Int(Rnd() * WIDTH), Int(Rnd() * HEIGHT)) ' 定义游戏得分 Dim score score = 0 ' 初始化游戏界面 Dim screen Set screen = CreateObject("WScript.Shell") screen.Run "cmd /c mode con cols=" & (WIDTH + 2) & " lines=" & (HEIGHT + 3), 0, True screen.Run "cmd /c cls", 0, True For i = 0 To HEIGHT + 1 For j = 0 To WIDTH + 1 If i = 0 Or i = HEIGHT + 1 Or j = 0 Or j = WIDTH + 1 Then WScript.StdOut.Write "#" Else WScript.StdOut.Write " " End If Next WScript.StdOut.WriteLine Next ' 游戏主循环 Do While True ' 显示蛇和食物 screen.Run "cmd /c cls", 0, True For i = 0 To HEIGHT + 1 For j = 0 To WIDTH + 1 If i = 0 Or i = HEIGHT + 1 Or j = 0 Or j = WIDTH + 1 Then WScript.StdOut.Write "#" ElseIf i = food(1) + 1 And j = food(0) + 1 Then WScript.StdOut.Write "@" Else Dim isBody isBody = False For k = 0 To snakeLength - 1 If i = snake(k)(1) + 1 And j = snake(k)(0) + 1 Then WScript.StdOut.Write "*" isBody = True Exit For End If Next If Not isBody Then WScript.StdOut.Write " " End If End If Next WScript.StdOut.WriteLine Next ' 移动蛇 Dim direction direction = screen.StdIn.Read(1) Dim head head = snake(snakeLength - 1) Select Case direction Case "w" snake(snakeLength - 1) = Array(head(0), head(1) - 1) Case "s" snake(snakeLength - 1) = Array(head(0), head(1) + 1) Case "a" snake(snakeLength - 1) = Array(head(0) - 1, head(1)) Case "d" snake(snakeLength - 1) = Array(head(0) + 1, head(1)) End Select If snake(snakeLength - 1)(0) < 0 Or snake(snakeLength - 1)(0) >= WIDTH Or snake(snakeLength - 1)(1) < 0 Or snake(snakeLength - 1)(1) >= HEIGHT Then Exit Do End If For i = 0 To snakeLength - 2 snake(i) = snake(i + 1) If snake(i)(0) = snake(snakeLength - 1)(0) And snake(i)(1) = snake(snakeLength - 1)(1) Then Exit Do End If Next ' 判断是否吃到食物 If snake(snakeLength - 1)(0) = food(0) And snake(snakeLength - 1)(1) = food(1) Then snakeLength = snakeLength + 1 ReDim Preserve snake(snakeLength - 1) snake(snakeLength - 1) = Array(head(0), head(1)) food = Array(Int(Rnd() * WIDTH), Int(Rnd() * HEIGHT)) score = score + 1 End If ' 显示得分 WScript.StdOut.Write "Score: " WScript.StdOut.WriteLine score ' 等待一段时间 WScript.Sleep 100 Loop ' 游戏结束 WScript.StdOut.WriteLine "Game Over!" WScript.StdOut.Write "Score: " WScript.StdOut.WriteLine score WScript.StdOut.Write "Press any key to exit..." screen.StdIn.Read(1) ``` 这只是一个简单的示例代码,你可以根据自己的需求进行修改和扩展。同时,注意代码的可读性和可维护性,尽可能使用模块化的编程方式,以便于后续的修改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值