5 ms·
Any hackers left here? Why no one mentions netcat? # send cat file | nc -l -p 8888 # receive nc IP-OF-SENDER 8888 > file this works as long
by enriquto 3y ago
Any hackers left here? Why no one mentions netcat?
# send
cat file | nc -l -p 8888
# receive
nc IP-OF-SENDER 8888 > file
this works as long as both computers are connected to the same network, for example the internet
- grumbel 3y agoThere is also: python -m http.server Which tends to be my go-to solution for file transfer between devices, it shares the current directory over HTTP. Not perfect, since HTTP makes downloading directories rather cumbersome, but at least every device that can open a website can download stuff.
- Loranubi 3y agoBecause there are no terminals on phones (by default).
- smartmic 3y agoOf course, this is a known way to do it for hackers. But the article clearly mentioned boundary conditions, among two are violated by the netcat trick: * It needs to be useable for a non-technical person * Its flow has to be consistent across platforms Besides having access to a terminal, netcat must be installed and hosts accessible, ports open etc. Not what is usually the case and especially not advisable when you operate on the internet level and not on protected local networks.
- GoblinSlayer 3y agoNontechnical people use messengers to send everything. Yet another tool to learn, switch and use would be only a hassle.
- GoblinSlayer 3y agoI ended up writing encrypted netcat.
- enriquto 3y agoWhat's the point? Just add encrypting filters at both ends of the pipe.
- GoblinSlayer 3y agoThe difference is small. Mine runs as a server and accepts transfers one after another, it's a bit more useful, because I send files regularly. It doesn't accept a transfer if the client fails authentication. Sometimes I send files between random machines ad hoc, having one tool (one file) makes it easier to setup, and not all have netcat installed, especially windows, but some linuxes too.
- PeterisP 3y agoAssume that both devices are behind a different NAT with no inbound ports publicly accessible, which is a very common scenario - e.g. a phone behind a cell provider's carrier-grade NAT and a computer on a firewalled corporate network. The median user controls 0 public IPv4 addresses.
- enriquto 3y agoWhat would a canonical hacker do here?
- PeterisP 3y agoThe median hacker would likely have something available with proper internet connectivity, they are substantially different from the median user. But many of the solutions mentioned in the article and comments will effectively use some "third place" to link the two devices, e.g. how magic wormhole does that.
- ogurechny 3y agoHacker usually has some kind of relay at hand: https://github.com/nwtgck/piping-server https://github.com/nwtgck/piping-server https://github.com/schollz/croc https://github.com/schollz/croc Or a NAT traversal tool: https://github.com/shawwwn/Gole https://github.com/shawwwn/Gole https://github.com/samyk/pwnat https://github.com/samyk/pwnat Or can just manually ncat simultaneously from both sides to proper addresses and ports, probably with the help of some public STUN server. Note that if worst case combination of NATs doesn't allow direct connection, then by definition a relay is needed, hacker or not, it doesn't matter.
- GoblinSlayer 3y agoFWIW I connect to my corporate network through VPN, so more or less direct connectivity exists. At least TCP works.
- NotPractical 3y agoI would also wrap it in a WireGuard tunnel, especially if doing it over the Internet, unless you want your fellow hackers intercepting everything you're transferring. P.S. I love WireGuard, it's easy to set up and allows you to use protocols with no encryption (or bad proprietary encryption) securely.
- Too 3y agoAt that point you might as well use ssh/scp.
- NotPractical 3y agoTrue, but in my experience WireGuard + unencrypted file transfer protocols is faster, not to mention more flexible. But if you already have SSH set up, that's a good option for sure. I used to use SSH port forwarding extensively before I discovered WireGuard.