wireshark would probably not be helpful - the data exchange is probably encrypted - most likely, the client would need to be modified to expose the data, between the decoding and the processing engine (if one even exists)
but, the telegram client was only given as a possible example - even if that one program does not exhibit the problematic behavior, there are probably many others which do - the mechanism is simply too tempting and trivially accomplished, to assume otherwise smalltalk devs were experimenting with this in the 70s, transferring code and execution states across machines - today, dynamic server control of client behavior, is fully ingrained into the javascript culture - now that the javascript beast has escaped its web-browser cage, it is a general concern for libre distro maintainers so, i am mainly looking for a general prescription, not only for the sake of any one application