back

by allanrbo·3y ago·view on hn ↗
Too bad there isn't a way to use the network of the machine running the browser... Maybe one could write some code that intercepts any outgoing network traffic from the VM, and instead of sending it via websockets to that 3rd party VPN, instead just finds packets that are part of a HTTP call and rewrites them to XMLHttpRequests. Would obviously only work for HTTP traffic, but that's probably a big majority. Might not work for HTTPS though. Oh, and DNS would have to respond with some sort of fantasy IP's that the Javascript host would have to keep track of.
2 comments
HTTP support seems possible, but it’s unlikely to be useful by itself. HTTPS is probably the majority and that’s a lot trickier (you’d have to MITM TLS in JS).

DNS is comparable to HTTP probably, since you could just use DNS-over-HTTPS and intercept DNS packets.

Wait until the emulator can run a modern kernel with eBPF support. Then use eBPF to intercept the SSL calls pre encryption, push via a map the requests to userspace, and then translate them to HTTP as you wish. Simple! ;P
I'm sure it can run modern kernels just fine, but how would eBPF help with TLS (which is almost exclusively implemented in userspace)?
You’d probably be looking for something like https://en.wikipedia.org/wiki/Slirp.