遠(yuǎn)程開啟/關(guān)閉目標(biāo)telnet服務(wù)的windows腳本RTCS.vbs
更新時(shí)間:2007年02月25日 00:00:00 作者:
********************************************************************************
RTCS v1.10
Remote Telnet Configure Script, by zzzEVAzzz
Welcome to visite www.isgrey.com
Usage:
cscript c:\scriptpath\RTCS.vbe targetIP username password NTLMAuthor telnetport
It will auto change state of target telnet server.
********************************************************************************
描述:遠(yuǎn)程開啟/關(guān)閉目標(biāo)telnet服務(wù)的windows腳本。
特點(diǎn):不依賴于目標(biāo)的ipc$開放與否。
原理:直接訪問目標(biāo)的windows管理規(guī)范服務(wù)(WMI)。該服務(wù)為系統(tǒng)重要服務(wù),默認(rèn)啟動(dòng)。
支持平臺(tái):win2kpro win2kserver winxp win.net
使用方法:
在命令行方式下使用windows自帶的腳本宿主程序cscript.exe調(diào)用腳本,例如:
c:\>cscript RTCS.vbe <目標(biāo)IP> <用戶名> <密碼> <NTLM驗(yàn)證方式> <telnet服務(wù)端口>
其中 NTLM 值可取0,1,2:
0: 不使用 NTLM 身份驗(yàn)證;
1: 先嘗試 NTLM 身份驗(yàn)證。如果失敗,再使用用戶名和密碼;
2: 只使用 NTLM 身份驗(yàn)證。
空密碼用兩個(gè)雙引號(hào)""表示。
腳本自動(dòng)檢查目標(biāo)telnet服務(wù)情況,如果未啟動(dòng)則啟動(dòng)它,相反就關(guān)閉。
同一個(gè)命令執(zhí)行兩遍,就開/關(guān)一次服務(wù)。
關(guān)閉服務(wù)時(shí)也必須輸入共5個(gè)參數(shù),這樣可以根據(jù)需要把服務(wù)設(shè)置還原為默認(rèn)值(NTLM=2,端口23)。
如果telnet服務(wù)被禁用,將自動(dòng)更改為“手動(dòng)”。
如果要對本地使用,IP地址為127.0.0.1或者一個(gè)點(diǎn)(用.表示),用戶名和密碼都為空(用""表示)。
此腳本為自由軟件,修改發(fā)布請著明原作者。謝謝合作。
本人提供有限技術(shù)支持,有問題請到論壇發(fā)短消息給我。我的ID是zzzevazzz
最后更新:2002-8-23
更新記錄:
1.10 更改了輸出顯示格式。
1.09 解決了空密碼的問題。
1.08 代碼加密并以測試版發(fā)布。
1.07 增加對付服務(wù)被“禁用”的功能。
1.06 解決在圖形界面下運(yùn)行的問題。
1.05 對參數(shù)做簡單判斷,防止誤操作。
1.04 增加顯示Usage和詳細(xì)過程功能。
1.03 增加關(guān)閉服務(wù)功能。
1.02 增加手動(dòng)設(shè)置端口和NTLM功能。
1.00 完成基本功能,遠(yuǎn)程啟動(dòng)telnet服務(wù),并設(shè)置NTLM=1。
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
RTCS v1.10
Remote Telnet Configure Script, by zzzEVAzzz
Welcome to visite www.isgrey.com
Usage:
cscript c:\scriptpath\RTCS.vbe targetIP username password NTLMAuthor telnetport
It will auto change state of target telnet server.
********************************************************************************
描述:遠(yuǎn)程開啟/關(guān)閉目標(biāo)telnet服務(wù)的windows腳本。
特點(diǎn):不依賴于目標(biāo)的ipc$開放與否。
原理:直接訪問目標(biāo)的windows管理規(guī)范服務(wù)(WMI)。該服務(wù)為系統(tǒng)重要服務(wù),默認(rèn)啟動(dòng)。
支持平臺(tái):win2kpro win2kserver winxp win.net
使用方法:
在命令行方式下使用windows自帶的腳本宿主程序cscript.exe調(diào)用腳本,例如:
c:\>cscript RTCS.vbe <目標(biāo)IP> <用戶名> <密碼> <NTLM驗(yàn)證方式> <telnet服務(wù)端口>
其中 NTLM 值可取0,1,2:
0: 不使用 NTLM 身份驗(yàn)證;
1: 先嘗試 NTLM 身份驗(yàn)證。如果失敗,再使用用戶名和密碼;
2: 只使用 NTLM 身份驗(yàn)證。
空密碼用兩個(gè)雙引號(hào)""表示。
腳本自動(dòng)檢查目標(biāo)telnet服務(wù)情況,如果未啟動(dòng)則啟動(dòng)它,相反就關(guān)閉。
同一個(gè)命令執(zhí)行兩遍,就開/關(guān)一次服務(wù)。
關(guān)閉服務(wù)時(shí)也必須輸入共5個(gè)參數(shù),這樣可以根據(jù)需要把服務(wù)設(shè)置還原為默認(rèn)值(NTLM=2,端口23)。
如果telnet服務(wù)被禁用,將自動(dòng)更改為“手動(dòng)”。
如果要對本地使用,IP地址為127.0.0.1或者一個(gè)點(diǎn)(用.表示),用戶名和密碼都為空(用""表示)。
此腳本為自由軟件,修改發(fā)布請著明原作者。謝謝合作。
本人提供有限技術(shù)支持,有問題請到論壇發(fā)短消息給我。我的ID是zzzevazzz
最后更新:2002-8-23
更新記錄:
1.10 更改了輸出顯示格式。
1.09 解決了空密碼的問題。
1.08 代碼加密并以測試版發(fā)布。
1.07 增加對付服務(wù)被“禁用”的功能。
1.06 解決在圖形界面下運(yùn)行的問題。
1.05 對參數(shù)做簡單判斷,防止誤操作。
1.04 增加顯示Usage和詳細(xì)過程功能。
1.03 增加關(guān)閉服務(wù)功能。
1.02 增加手動(dòng)設(shè)置端口和NTLM功能。
1.00 完成基本功能,遠(yuǎn)程啟動(dòng)telnet服務(wù),并設(shè)置NTLM=1。
復(fù)制代碼 代碼如下:
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
相關(guān)文章
使用 Iisftp.vbs 啟動(dòng)FTP站點(diǎn)的方法
這篇文章主要介紹了使用 Iisftp.vbs 啟動(dòng)FTP站點(diǎn)的方法,需要的朋友可以參考下2014-07-07VBS 提取狗狗影視中的ED2K連接的實(shí)現(xiàn)代碼
這篇文章主要介紹了通過VBS 提取狗狗影視中的ED2K連接,需要的朋友可以參考下2013-07-07vbs腳本實(shí)現(xiàn)批量轉(zhuǎn)換文件編碼
這篇文章主要介紹了vbs腳本實(shí)現(xiàn)批量轉(zhuǎn)換文件編碼,可以批量對文件在Gb2312和UTF-8編碼間互相轉(zhuǎn)換,需要的朋友可以參考下2014-06-06VBscript教程 第五課 VBScript常數(shù)
VBscript教程 第五課 VBScript常數(shù)...2006-11-11用VBS可執(zhí)行程序+Xmlhttp下載備份網(wǎng)上文件的代碼
用VBS可執(zhí)行程序+Xmlhttp下載備份網(wǎng)上文件的代碼...2007-08-08TXT轉(zhuǎn)HTM、HTML「TXT轉(zhuǎn)網(wǎng)頁」的vbs實(shí)現(xiàn)代碼
試用過的Visual CHM,Power CHM,Easy CHM也非常令人失望??磥磉€是自給自足吧。本文介紹的方法不一定適用于所有用戶,看不懂的同學(xué)一律不要提問和請教2011-11-11