Fiddling With The User-Agent
We should also determine if the
Net.WebClient download cradle can modify the User-Agent property.
When making HTTP or HTTPS requests from a web browser,
one of the most easily identifiable characteristics of that session
is the User-Agent.
It quickly tells us which type of web browser or other application
is performing the request
along with the operating system version.
The Net.WebClient PowerShell download cradle
does not have a default User-Agent set,
which means the session will stand out from other legitimate traffic.
Luckily for us,
we can customize this using the Headers property of the Net.WebClient object
using the Add method,
and setting a custom user agent.
Running the code,
will download the file and leave behind the User-Agent text
in the Apache access logs
as we can verify by inspecting the latest entry.
Obviously, a User-Agent like this
sticks out even more than an empty User-Agent string.
Instead, we should emulate a User-Agent from a real web browser like Google Chrome
or Internet Explorer.