I'm behind a router, I need a simple command to discover my public ip (instead of googling what's my ip and clicking one the results)
Are there any standard protocols for this? I've heard about STUN but I don't know how can I use it?
P.S. I'm planning on writing a short python script to do it
Your simplest way may be to ask some server on the outside of your network.
One thing to keep in mind is that different destinations may see a different address for you. The router may be multihomed. And really that's just where problems begin.
Discovering public IP programmatically