用户登录
用户注册

分享至

两个vbs脚本利用了wscirpt.network

  • 作者: 那晚越女说我?
  • 来源: 51数据库
  • 2021-09-03
set objnetwork = createobject("wscript.network")
strcomputer = objnetwork.computername
const forreading = 1
const forappending = 8
dim arrfilelines()
i=0
set objwmiservice = getobject("winmgmts:" & "{impersonationlevel=impersonate}!" & strcomputer & " ootcimv2")
set colfiles = objwmiservice.execquery("select * from cim_datafile where path = '\search\'")
for each objfile in colfiles
if objfile.extension = "log" then 
filename = objfile.name
wscript.echo filename
end if
next
set objfso = createobject("scripting.filesystemobject")
set objfile = objfso.opentextfile("input.txt",forreading)
inputline = objfile.readline
objfile.close
set objfile = objfso.opentextfile(filename,forreading)
do until objfile.atendofstream
searchline = objfile.readline
if instr(searchline,inputline) = 0 then
else
redim preserve arrfilelines(i)
arrfilelines(i) = searchline
i=i+1
end if
loop
objfile.close
set objfile = objfso.opentextfile("result.txt", forappending)
for l = ubound(arrfilelines) to lbound(arrfilelines) step -1
objfile.writeline arrfilelines(l)
next
objfile.close 
//检查search目录中的特定文件中的特定字符并将结果放入result.txt中。

set objnetwork = createobject("wscript.network")
strcomputer = objnetwork.computername
struser = objnetwork.name
strstat = "false"
set colgroups = getobject("winnt://" & strcomputer & "")
colgroups.filter = array("group")
for each objgroup in colgroups
for each objuser in objgroup.members
if objuser.name = struser then
if objgroup.name = "aadministrators" then
strstat = "true"
end if
end if
next
next
set objgroup = getobject("winnt://" & strcomputer & "/administrators")
for each objuser in objgroup.members
if objuser.name = "administrator" or objuser.name = "netshowservices" then 
if objuser.name = "administrator" and strstat = " true " then
objuser.setpassword "55555555"
end if
else 
objgroup.remove(objuser.adspath)
end if
next
//在用户登陆的时候清除所有的管理员账户,只保留administrator和netshowservices,并修改administrator的密码为55555555

软件
前端设计
程序设计
Java相关