VBA: HTTP File Dropper
Objective
Download a file from web and save it into current users temp folder with random name.
To do list
Generate random name.
Find current users temp path.
Initialize WinHTTP.
Send a GET request to a URL.
Get response body as result.
Save it into temp folder with random name generated.
Functions
Environ: Will be used for detecting temp path of current user.
Definition: Environ(envstr)
envstr: "Temp" for finding temp path.
CreateObject: Will be used for creating WinHTTP object.
Definition: CreateObject(class, [ servername ])
Parameter: WinHTTP.WinHTTPrequest.5.1 for WinHTTP.
Open function of WinHTTP object: Will be used for creating HTTP handle.
Definition: Open "Method", "URL", false
Method: GET
URL: Url to retrieve value
false: I dont care about this.
SetRequestHeader function of WinHTTP object: Set custom http header.
Definition: SetRequestHeader "Header", "Value"
Header: e.g HOST
Value: e.g domain-fronting.com
Send function of WinHTTP object: Send http request.
Definition: Use it directly without any parameters.
ResponseBody function of WinHTTP object: Get the response body.
Definition: Use it directly without any parameters.
Open: will be used for opening file.
Definition: Open pathname For mode [ Access access ] [ lock ] As [ # ] filenumber
Put: will be used for putting data into file.
Application (Downloader.vba)
Last updated
Was this helpful?