Using websockets to easily build GUIs for Python programs
gist.github.com
gist.github.com
https://blogs.msdn.microsoft.com/tonyschr/2004/03/30/drivers...
Even if it's just restricted to the local machine, any application that seemingly should have nothing to do with the network is going to arouse plenty of unneeded suspicion if it starts listening on a port or creating connections. Several years ago I remember coming across an application written in Python that did something similar, and its forums had users complaining that their firewall had detected something or that it was otherwise not working. I downloaded the executable, analysed it to discover the above, and decided to find an alternative instead.
Why an app exposing itself to a local GUI process would listen on anything but localhost?
I wonder if websockets can work on Unix domain sockets; it's the normal way for non-websockets programs of a similar architecture.
Not sure about now but it used to be very common for adware/spyware to setup a local HTTP proxy and reroute all traffic through that.
There's also the "why is this app that has nothing to do with the network, doing something with networking?" angle to consider. Some malware would try to hide by injecting itself into other innocuous processes.
I recently built a TicTacToe game[2] in it in the fraction of the time it would take me just to setup a webapp. It's pretty impressive and goes to show how badly setup the web is for apps.
[1]: https://github.com/dddomodossola/remi
[2]: https://repl.it/talk/share/Tic-Tac-Toe-in-remi-a-cross-platf...
Ok, sure
>It's pretty impressive and goes to show how badly setup the web is for apps
That conclusion really doesn't seem to follow for me. Someone else wrote a library that does all of the setup work, and then you didn't have to do that work, so you concluded that something else wasn't well set up?
Now we need a good connector library so that we can program in any language of our choice and use the web stack for seamless display. Web sockets are a good start but we could do better.
I guess flutter has really spoiled me; my expectations from a UI framework are just too damn high now xD
Web is a cancer on tech. A giant, bloated, broken mess, built emergently, without any cohesiveness or vision. Simple applications come with hundreds of external dependencies, many of which regularly release breaking updates. It is simply impossible to consistently find up to date documentation on best usage for many of these libraries because of the speed with which the space moves, not necessarily toward anything good. Not to mention the incredibly dangerous nature of such a loosly typed language like JavaScript.
In my opinion, the whole system needs to be burnt to the ground to make way for something cleaner, safer, and more secure.
Then again, maybe I'm just biased by my preference for backend coding.
So it's possible for any page on the net (eg evil.com) to connect to your socket and exfiltrate any data.
Make sure all tabs are closed and never visit any sites with advertising on it while this is running.
[1]: https://github.com/Pithikos/python-websocket-server/issues/1...
I understand that the generic answer will be along the lines: "well, if you have local access, you're never safe", but there is zero protection here. Anything local can connect to it and impersonate the "front end".
electron + ES6 + html5 + no package installs + linux/macos/windows portable = why bother with anything else?
Electron apps are not generic browsers that run random content from the web: they are fully debug-able projects, and the developers have full control over what is deployed.
You know, like ANY compiled project that is shipped as an .exe/.dmg.
Nice try though.
My money's on sed and /etc/network/interfaces.
But this same method could be used for remote clients as well; I have a websocket-based "dashboard" for a project I'm working on that will potentially have to scale to thousands or more of remote clients. For a case like that, scaling is indeed a concern.
For example, the very simple websocket server used in the article won't scale well beyond a certain point because it spawns a new thread per client; something like gevent (which is what my dashboard uses) will scale much better. (Also the server in the example just exits on any exception; you need more robust error handling for something that needs to handle remote clients.)