Live data from Hacker News

`curl wttr.in`: Weather in your terminal

github.com

71–80 of 147 posts

Re: `curl wttr.in`: Weather in your terminal

#71
post #66

Earlier quoted context omitted.

but imagine if you're in a bunker hacking on your fav project, no artificial light and you wonder.. shall i go to the surface? you curl this website and, if tolerable weather conditions, you plan your ascent.

There isno weather app which gives you the status of nuclear downfall.

we should put top people on this, just in case.

Re: `curl wttr.in`: Weather in your terminal

#72
post #15

Remember with this kind of thing you're trusting the remote site with access to your terminal emulator. There have been various security problems with some more advanced terminals and escape sequences in the past[1][2]. Personally I think it's a cute thing and have implemented some similar little easter eggs to this via: curl ip.wtf/moo [1]: https://blog.mozilla.org/security/2019/10/09/iterm2-critical... [2]: https:/…

Is curl unsafe? This is a pretty basic invocation of curl, no fancy flags needed.

Curl isn't the problem they're describing. The remote can assume you're running it in a terminal (especially since the user agent string indicates you're using curl) and can send malicious escape sequences in the body, which will be interpreted by your terminal emulator in most cases.

This is true of any program that prints output directly from a remote host / untrusted source.

In the event your terminal emulator has a vulnerability or allows you to run arbitrary commands (this is a feature of some emulators), the site can target that functionality for users of that emulator and wreak havoc.

I maintain a lot of ANSI escape related code. These exploits have always been theorized, but I've not once heard about this being exploited in the wild. It's certainly possible. Not very probable. Refer to your threat model, as always.

Re: `curl wttr.in`: Weather in your terminal

#73
post #7

Earlier quoted context omitted.

That would be cool, but how would you condense the information enough that it's both useful and doesn't take up 2/3 of a line?

Emojis? For the current weather, a single emoji could convey quite a lot; e.g. a snowflake for sub-60 weather (I have a low tolerance for cold), a sun for 60-80, fire emoji for 80+... Now, I don't know if anyone truly needs the weather in their terminal prompt, but it is doable.

Microcharts or sparklines are another option. I've seen a few implementations along these lines for shell prompts / shell use.

This might be useful for temperature, humidity, wind, preciptitation, and similar measures, either as quantities or timelines.

https://en.wikipedia.org/wiki/Sparkline

https://github.com/deeplook/sparklines

Similar:

https://www.linux-magazine.com/Issues/2016/183/Calc-Conditio...

Re: `curl wttr.in`: Weather in your terminal

#74

I have to scroll all they way down to the buttom to find the information source -- WorldWeatherOnline. Does people not care about where their whether data is sourced from? Living in Japan, I have always been wary of these type of service, since I find a lot of them really inaccurate. And I just checked, Tokyo show 15C on that website, while high resolution current weather information from Japan Metrological Agency sh…

I agree. I always avoid these aggregators that offer world-wide coverage. The quality of the data is often questionable.

As a cyclist I'm mostly interested in rain. So I check the rain radar of the national weather service, which has excellent resolution.

Even when travelling I spend 5 minutes to dig out the relevant local pages of a national weather service and bookmark them. Not something I have to do so frequently that any kind of automation would be needed.

Weather apps and this client are a solutions in search of a real problem. Yes, it's a nice demo, I like working with the terminal. But I am not working with weather all day long.

Re: `curl wttr.in`: Weather in your terminal

#75
post #15

Remember with this kind of thing you're trusting the remote site with access to your terminal emulator. There have been various security problems with some more advanced terminals and escape sequences in the past[1][2]. Personally I think it's a cute thing and have implemented some similar little easter eggs to this via: curl ip.wtf/moo [1]: https://blog.mozilla.org/security/2019/10/09/iterm2-critical... [2]: https:/…

If you have a vulnerable terminal emulator, yes. Well, the same holds for every web site you visit if you have a vulnerable browser.

Re: `curl wttr.in`: Weather in your terminal

#76
post #75
post #15

Remember with this kind of thing you're trusting the remote site with access to your terminal emulator. There have been various security problems with some more advanced terminals and escape sequences in the past[1][2]. Personally I think it's a cute thing and have implemented some similar little easter eggs to this via: curl ip.wtf/moo [1]: https://blog.mozilla.org/security/2019/10/09/iterm2-critical... [2]: https:/…

If you have a vulnerable terminal emulator, yes. Well, the same holds for every web site you visit if you have a vulnerable browser.

Unless there were an escape sequence meaning "execute this". I am not aware such beast would exist.

Re: `curl wttr.in`: Weather in your terminal

#78

so the obvious (for me) thing to try was: watch -n 600 -c 'curl -s v2.wttr.in/' This ALMOST works, but somehow it messes up the formatting for me. For some reason watch doesn't pass through formatting cleanly or so?

This is not a problem with wttr.in, this is a problem of `watch`. It is a known issue: it can't render ANSI output.

You can try to run it with any command that has ANSI output, and you will see it.

As a simple alternative, you write your own 'watch' like this:

while true; do curl -s wttr.in; sleep 60; clear; done

Re: `curl wttr.in`: Weather in your terminal

#80

Earlier quoted context omitted.

This is true of anything that ever renders to your terminal. I'm not sure this class of issue is worth worrying about, generally. Sure, these are neat and scary examples. Have you seen some of the recent GPU driver ACEs? Better not render any graphics! A generalization of this is "receiving information from third parties can lead to security issues" which is of course true. Untrusted inputs are always untrusted. Pipi…

> Better not render any graphics! Unironically a good idea. Graphics have always been a mistake - most engineers would agree that if we stuck with very basic output, our software would be in a much better place than today (and more usable, too!)

source on most engineers?
Post reply on HN