两个vbs脚本利用了wscirpt.network
程序员文章站
2022-03-20 14:07:38
set objnetwork = createobject("wscript.network") strcomputer =&nbs...
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
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
上一篇: 如何成为一名黑客全系列说明第1/2页