What can I do to prevent this in the future?
If you are on a personal connection, like at home, you can run
an anti-virus scan on your device to make sure it is not infected
with malware.
If you are at an office or shared network, you can ask the
network administrator to run a scan across the network looking for
misconfigured or infected devices.