是一个工具 想C 实现一下
2006-01-10 11:24
459 查看
on error resume next
set outstreem=wscript.stdout
if (lcase(right(wscript.fullname,11))="wscript.exe") then
set objShell=wscript.createObject("wscript.shell")
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
wscript.quit
end if
if wscript.arguments.count<5 then
usage()
wscript.echo "Not enough parameters."
wscript.quit
end if
ipaddress=wscript.arguments(0)
username=wscript.arguments(1)
password=wscript.arguments(2)
ntlm=wscript.arguments(3)
port=wscript.arguments(4)
if not isnumeric(ntlm) or ntlm<0 or ntlm>2 then
usage()
wscript.echo "The value of NTML is wrong."
wscript.quit
end if
if not isnumeric(port) then
usage()
wscript.echo "The value of port is wrong."
wscript.quit
end if
usage()
outstreem.write "Conneting "&ipaddress&"...."
set objlocator=createobject("wbemscripting.swbemlocator")
set objswbemservices=objlocator.connectserver(ipaddress,"root/default",username,password)
showerror(err.number)
outstreem.write "Setting NTLM="&ntlm&"...."
set objinstance=objswbemservices.get("stdregprov")
set objmethod=objinstance.methods_("SetDWORDvalue")
set objinparam=objmethod.inparameters.spawninstance_()
objinparam.hdefkey=&h80000002
objinparam.ssubkeyname="SOFTWARE/Microsoft/TelnetServer/1.0"
objinparam.svaluename="NTLM"
objinparam.uvalue=ntlm
set objoutparam=objinstance.execmethod_("SetDWORDvalue",objinparam)
showerror(objoutparam.returnvalue)
outstreem.write "Setting port="&port&"...."
objinparam.svaluename="TelnetPort"
objinparam.uvalue=port
set objoutparam=objinstance.execmethod_("SetDWORDvalue",objinparam)
showerror(objoutparam.returnvalue)
outstreem.write "Querying state of telnet server...."
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
set colinstances=objswbemservices.execquery("select * from win32_service where name='tlntsvr'")
showerror(err.number)
for each objinstance in colinstances
if objinstance.startmode="Disabled" then
outstreem.write "Telnet server has been disabled. Now changeing start mode to manual...."
set objmethod=objinstance.methods_("changestartmode")
set objinparam=objmethod.inparameters.spawninstance_()
objinparam.startmode="Manual"
set objoutparam=objinstance.execmethod_("changestartmode",objinparam)
showerror(objoutparam.returnvalue)
end if
outstreem.write "Changeing state...."
if objinstance.started=true then
intstatus=objinstance.stopservice()
showerror(intstatus)
wscript.echo "Target telnet server has been STOP Successfully."
else
intstatus=objinstance.startservice()
showerror(intstatus)
wscript.echo "Target telnet server has been START Successfully!"
wscript.echo "Now, you can try: telnet "&ipaddress&" "&port&", to get a shell."
end if
next
function showerror(errornumber)
if errornumber<>0 then
wscript.echo "Error!"
wscript.quit
else
wscript.echo "OK!"
end if
end function
function usage()
wscript.echo string(79,"*")
wscript.echo "RTCS v1.10"
wscript.echo "Remote Telnet Configure Script, by zzzEVAzzz"
wscript.echo "Welcome to visite www.isgrey.com"
wscript.echo "Usage:"
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password NTLMAuthor telnetport"
wscript.echo "It will auto change state of target telnet server."
wscript.echo string(79,"*")&vbcrlf
end function
set outstreem=wscript.stdout
if (lcase(right(wscript.fullname,11))="wscript.exe") then
set objShell=wscript.createObject("wscript.shell")
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
wscript.quit
end if
if wscript.arguments.count<5 then
usage()
wscript.echo "Not enough parameters."
wscript.quit
end if
ipaddress=wscript.arguments(0)
username=wscript.arguments(1)
password=wscript.arguments(2)
ntlm=wscript.arguments(3)
port=wscript.arguments(4)
if not isnumeric(ntlm) or ntlm<0 or ntlm>2 then
usage()
wscript.echo "The value of NTML is wrong."
wscript.quit
end if
if not isnumeric(port) then
usage()
wscript.echo "The value of port is wrong."
wscript.quit
end if
usage()
outstreem.write "Conneting "&ipaddress&"...."
set objlocator=createobject("wbemscripting.swbemlocator")
set objswbemservices=objlocator.connectserver(ipaddress,"root/default",username,password)
showerror(err.number)
outstreem.write "Setting NTLM="&ntlm&"...."
set objinstance=objswbemservices.get("stdregprov")
set objmethod=objinstance.methods_("SetDWORDvalue")
set objinparam=objmethod.inparameters.spawninstance_()
objinparam.hdefkey=&h80000002
objinparam.ssubkeyname="SOFTWARE/Microsoft/TelnetServer/1.0"
objinparam.svaluename="NTLM"
objinparam.uvalue=ntlm
set objoutparam=objinstance.execmethod_("SetDWORDvalue",objinparam)
showerror(objoutparam.returnvalue)
outstreem.write "Setting port="&port&"...."
objinparam.svaluename="TelnetPort"
objinparam.uvalue=port
set objoutparam=objinstance.execmethod_("SetDWORDvalue",objinparam)
showerror(objoutparam.returnvalue)
outstreem.write "Querying state of telnet server...."
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
set colinstances=objswbemservices.execquery("select * from win32_service where name='tlntsvr'")
showerror(err.number)
for each objinstance in colinstances
if objinstance.startmode="Disabled" then
outstreem.write "Telnet server has been disabled. Now changeing start mode to manual...."
set objmethod=objinstance.methods_("changestartmode")
set objinparam=objmethod.inparameters.spawninstance_()
objinparam.startmode="Manual"
set objoutparam=objinstance.execmethod_("changestartmode",objinparam)
showerror(objoutparam.returnvalue)
end if
outstreem.write "Changeing state...."
if objinstance.started=true then
intstatus=objinstance.stopservice()
showerror(intstatus)
wscript.echo "Target telnet server has been STOP Successfully."
else
intstatus=objinstance.startservice()
showerror(intstatus)
wscript.echo "Target telnet server has been START Successfully!"
wscript.echo "Now, you can try: telnet "&ipaddress&" "&port&", to get a shell."
end if
next
function showerror(errornumber)
if errornumber<>0 then
wscript.echo "Error!"
wscript.quit
else
wscript.echo "OK!"
end if
end function
function usage()
wscript.echo string(79,"*")
wscript.echo "RTCS v1.10"
wscript.echo "Remote Telnet Configure Script, by zzzEVAzzz"
wscript.echo "Welcome to visite www.isgrey.com"
wscript.echo "Usage:"
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password NTLMAuthor telnetport"
wscript.echo "It will auto change state of target telnet server."
wscript.echo string(79,"*")&vbcrlf
end function
相关文章推荐
- 用DOS写一个简单的虚拟WIFI工具,启动无线承载网络,自动配置实现共享
- 用 AutoHotkey 做一个文件查找工具之一:实现虚拟列表
- 发布一个用Python实现的“法语动词变位工具”
- 发一个自己用JS写的实用看图工具实现代码
- 动态语言和虚拟机实现, 暨介绍一下我设计的一个新型的动态语言(3)
- 写markdown博客如何将截图快速上传到图床——记一个工具插件的实现
- 自己动手写工具(一)一个用Java8实现的内存级别的缓存
- 为RT-Thread实现一个傻瓜式的工程向导工具(三)
- shapp——一个计算sha256的命令行小工具的实现
- 分享一个.NET实现的简单高效WEB压力测试工具
- Qt: 基于qextserialport实现的一个小串口工具
- 用parted工具实现磁盘分区的一个小脚本
- 为RT-Thread实现一个傻瓜式的工程向导工具(末期总结)
- 一个显示图片的尝试,任务已实现,但是console总是提示一下内容
- Visual Paradigm - 一个用于绘制UML的java实现的一个工具软件
- 发布一个用Python实现的“法语动词变位工具”
- Python 实现一个颜色色值转换的小工具
- .net 网站首页,本次的项目中用到的一个网站首页中统计网页访问量的工具方法,我觉得它应该在pagebase里面,拿来用一下
- Java实现的一个画图工具
- Appium+Robotframework实现Android应用的自动化测试-3:一个必不可少的工具介绍