遠程開啟/關(guān)閉目標(biāo)telnet服務(wù)的windows腳本RTCS.vbs
********************************************************************************
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.
********************************************************************************
描述:遠程開啟/關(guān)閉目標(biāo)telnet服務(wù)的windows腳本。
特點:不依賴于目標(biāo)的ipc$開放與否。
原理:直接訪問目標(biāo)的windows管理規(guī)范服務(wù)(WMI)。該服務(wù)為系統(tǒng)重要服務(wù),默認(rèn)啟動。
支持平臺:win2kpro win2kserver winxp win.net
使用方法:
在命令行方式下使用windows自帶的腳本宿主程序cscript.exe調(diào)用腳本,例如:
c:\>cscript RTCS.vbe <目標(biāo)IP> <用戶名> <密碼> <NTLM驗證方式> <telnet服務(wù)端口>
其中 NTLM 值可取0,1,2:
0: 不使用 NTLM 身份驗證;
1: 先嘗試 NTLM 身份驗證。如果失敗,再使用用戶名和密碼;
2: 只使用 NTLM 身份驗證。
空密碼用兩個雙引號""表示。
腳本自動檢查目標(biāo)telnet服務(wù)情況,如果未啟動則啟動它,相反就關(guān)閉。
同一個命令執(zhí)行兩遍,就開/關(guān)一次服務(wù)。
關(guān)閉服務(wù)時也必須輸入共5個參數(shù),這樣可以根據(jù)需要把服務(wù)設(shè)置還原為默認(rèn)值(NTLM=2,端口23)。
如果telnet服務(wù)被禁用,將自動更改為“手動”。
如果要對本地使用,IP地址為127.0.0.1或者一個點(用.表示),用戶名和密碼都為空(用""表示)。
此腳本為自由軟件,修改發(fā)布請著明原作者。謝謝合作。
本人提供有限技術(shù)支持,有問題請到論壇發(fā)短消息給我。我的ID是zzzevazzz
最后更新:2002-8-23
更新記錄:
1.10 更改了輸出顯示格式。
1.09 解決了空密碼的問題。
1.08 代碼加密并以測試版發(fā)布。
1.07 增加對付服務(wù)被“禁用”的功能。
1.06 解決在圖形界面下運行的問題。
1.05 對參數(shù)做簡單判斷,防止誤操作。
1.04 增加顯示Usage和詳細過程功能。
1.03 增加關(guān)閉服務(wù)功能。
1.02 增加手動設(shè)置端口和NTLM功能。
1.00 完成基本功能,遠程啟動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
欄 目:vb
下一篇:bytes2BSTR
本文標(biāo)題:遠程開啟/關(guān)閉目標(biāo)telnet服務(wù)的windows腳本RTCS.vbs
本文地址:http://www.jygsgssxh.com/a1/vb/8012.html
您可能感興趣的文章
- 01-10VBS教程:方法-Close 方法
- 01-10Restart.vbs源代碼可以重啟遠程電腦的vbs
- 01-10遠程或本地獲取系統(tǒng)信息的腳本RGIS.vbs
- 01-10遠程啟動終端服務(wù)的windows腳本ROTS.vbs
- 01-10vbs中實現(xiàn)啟動兩個應(yīng)用程序,一直等到其中一個程序結(jié)束,然后
- 01-10用vbs腳本來關(guān)閉 HTML 頁面的代碼
- 01-10可以從一臺遠程服務(wù)器運行 SP2 安裝程序Install.vbs
- 01-10用vbs讀取遠程計算機上的文本文件的代碼
- 01-10vbs更改3389遠程桌面端口的腳本
- 01-10用vbs操作注冊表實例代碼


閱讀排行
本欄相關(guān)
- 01-10下載文件到本地運行的vbs
- 01-10飄葉千夫指源代碼,又稱qq刷屏器
- 01-10SendKeys參考文檔
- 01-10什么是一個高效的軟件
- 01-10VBS中的正則表達式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本應(yīng)用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一課深入VBScript
- 01-10VBScript語法速查及實例說明
隨機閱讀
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 01-10delphi制作wav文件的方法
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 08-05織夢dedecms什么時候用欄目交叉功能?
- 04-02jquery與jsp,用jquery
- 01-11ajax實現(xiàn)頁面的局部加載
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 01-10C#中split用法實例總結(jié)
- 01-10使用C語言求解撲克牌的順子及n個骰子


