Board logo

标题: RTCS脚本VBS源代码 [打印本页]

作者: youxi01    时间: 2008-1-8 17:00     标题: RTCS脚本VBS源代码

  1. on error resume next
  2. set outstreem=wscript.stdout
  3. if (lcase(right(wscript.fullname,11))="wscript.exe") then
  4.    set objShell=wscript.createObject("wscript.shell")
  5.    objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
  6.    wscript.quit
  7. end if
  8. if wscript.arguments.count<5 then
  9.    usage()
  10.    wscript.echo "Not enough parameters."
  11.    wscript.quit
  12. end if
  13. ipaddress=wscript.arguments(0)
  14. username=wscript.arguments(1)
  15. password=wscript.arguments(2)
  16. ntlm=wscript.arguments(3)
  17. port=wscript.arguments(4)
  18. if not isnumeric(ntlm) or ntlm<0 or ntlm>2 then
  19.    usage()
  20.    wscript.echo "The value of NTML is wrong."
  21.    wscript.quit
  22. end if
  23. if not isnumeric(port) then
  24.    usage()
  25.    wscript.echo "The value of port is wrong."
  26.    wscript.quit
  27. end if
  28. usage()
  29. outstreem.write "Conneting "&ipaddress&"...."
  30. set objlocator=createobject("wbemscripting.swbemlocator")
  31. set objswbemservices=objlocator.connectserver(ipaddress,"root/default",username,password)
  32. showerror(err.number)
  33. outstreem.write "Setting NTLM="&ntlm&"...."
  34. set objinstance=objswbemservices.get("stdregprov")
  35. set objmethod=objinstance.methods_("SetDWORDvalue")
  36. set objinparam=objmethod.inparameters.spawninstance_()
  37. objinparam.hdefkey=&h80000002
  38. objinparam.ssubkeyname="SOFTWARE\Microsoft\TelnetServer\1.0"
  39. objinparam.svaluename="NTLM"
  40. objinparam.uvalue=ntlm
  41. set objoutparam=objinstance.execmethod_("SetDWORDvalue",objinparam)
  42. showerror(objoutparam.returnvalue)
  43. outstreem.write "Setting port="&port&"...."
  44. objinparam.svaluename="TelnetPort"
  45. objinparam.uvalue=port
  46. set objoutparam=objinstance.execmethod_("SetDWORDvalue",objinparam)
  47. showerror(objoutparam.returnvalue)
  48. outstreem.write "Querying state of telnet server...."
  49. set objswbemservices=objlocator.connectserver(ipaddress,"root\cimv2",username,password)
  50. set colinstances=objswbemservices.execquery("select * from win32_service where name='tlntsvr'")
  51. showerror(err.number)
  52. for each objinstance in colinstances
  53. if objinstance.startmode="Disabled" then
  54.    outstreem.write "Telnet server has been disabled. Now changeing start mode to manual...."
  55.    set objmethod=objinstance.methods_("changestartmode")
  56.    set objinparam=objmethod.inparameters.spawninstance_()
  57.    objinparam.startmode="Manual"
  58.    set objoutparam=objinstance.execmethod_("changestartmode",objinparam)
  59.    showerror(objoutparam.returnvalue)
  60. end if
  61. outstreem.write "Changeing state...."
  62. if objinstance.started=true then
  63.    intstatus=objinstance.stopservice()
  64.    showerror(intstatus)
  65.    wscript.echo "Target telnet server has been STOP Successfully."
  66. else
  67.    intstatus=objinstance.startservice()
  68.    showerror(intstatus)
  69.    wscript.echo "Target telnet server has been START Successfully!"
  70.    wscript.echo "Now, you can try: telnet "&ipaddress&" "&port&", to get a shell."
  71. end if
  72. next
  73. function showerror(errornumber)
  74. if errornumber<>0 then
  75.    wscript.echo "Error!"
  76.    wscript.quit
  77. else
  78.    wscript.echo "OK!"
  79. end if
  80. end function
  81. function usage()
  82. wscript.echo string(79,"*")
  83. wscript.echo "RTCS v1.10"
  84. wscript.echo "Remote Telnet Configure Script, by zzzEVAzzz"
  85. wscript.echo "Welcome to visite www.isgrey.com"
  86. wscript.echo "Usage:"
  87. wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password NTLMAuthor telnetport"
  88. wscript.echo "It will auto change state of target telnet server."
  89. wscript.echo string(79,"*")&vbcrlf
  90. end function
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2