It isn’t illegal to run Wireshark on a public network. However, pay attention to the Terms and Conditions of the network you want to use Wireshark on. They may prohibit the use of Wireshark, in which case you could be banned from the network or even sued for using it.