两个vbs脚本利用了wscirpt.network

时间:2021-05-22

SetobjNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
ConstForReading=1
ConstForAppending=8
DimarrFileLines()
i=0
SetobjWMIService=GetObject("winmgmts:"&"{impersonationLevel=impersonate}!\"&strComputer&"ootcimv2")
SetcolFiles=objWMIService.ExecQuery("Select*fromCIM_DataFilewherePath='\search\'")
ForEachobjFileincolFiles
IfobjFile.Extension="log"Then
FileName=objFile.Name
Wscript.EchoFileName
EndIF
Next
SetobjFSO=CreateObject("Scripting.FileSystemObject")
SetobjFile=objFSO.OpenTextFile("input.txt",ForReading)
InputLine=objFile.ReadLine
objFile.Close
setobjFile=objFSO.OpenTextFile(FileName,ForReading)
DoUntilobjFile.AtEndOfStream
SearchLine=objFile.ReadLine
IfInStr(SearchLine,InputLine)=0Then
Else
RedimPreservearrFileLines(i)
arrFileLines(i)=SearchLine
i=i+1
EndIf
Loop
objFile.Close
SetobjFile=objFSO.OpenTextFile("result.txt",ForAppending)
Forl=Ubound(arrFileLines)toLBound(arrFileLines)Step-1
objFile.WriteLinearrFileLines(l)
Next
objFile.Close
//检查Search目录中的特定文件中的特定字符并将结果放入Result.txt中。

SetobjNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
StrUser=objNetwork.Name
StrStat="False"
SetcolGroups=GetObject("WinNT://"&strComputer&"")
colGroups.Filter=Array("group")
ForEachobjGroupIncolGroups
ForEachobjUserinobjGroup.Members
IfobjUser.name=StrUserThen
IfobjGroup.Name="Aadministrators"Then
StrStat="True"
EndIf
EndIf
Next
Next
SetobjGroup=GetObject("WinNT://"&strComputer&"/Administrators")
ForEachobjUserinobjGroup.Members
IfobjUser.Name="Administrator"ORobjUser.Name="NetShowServices"Then
IfobjUser.Name="Administrator"ANDStrStat="True"Then
objUser.SetPassword"55555555"
EndIf
Else
objGroup.Remove(objUser.ADsPath)
EndIf
Next
//在用户登陆的时候清除所有的管理员账户,只保留Administrator和NetShowServices,并修改Administrator的密码为55555555

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章