Yes, but that is nothing to do with which network you are on, unless you suspect the operators of a specific network to be trying to install such software.
Anything you connect to, and via, can potentially inject something in order to (amongst many other things) install that kind of spy software.
- a website could be compromised and pushing malware (this includes any ads on the site)
- any network operator between you and your intended destination could try and manipulate your connection to do this (for example, placing Burp somewhere on the path, and if necessary, trying to downgrade your connection to plaintext)
That's why it is important to keep everything updated to the latest possible version and to try and exercise caution when online.
On some networks, there may be things protecting you, too, like scanning proxies/gateways, IDSes, and so on.