Real Hackers Use 'netcat' To Transfer Files

preview_player
Показать описание
I needed to copy a file between two computers on the same LAN as fast as possible, but I didn't have any USB flash drives available. To solve this problem, I used the 'netcat' command to pipe the file directly between the two computers over a raw TCP connection.

SOCIALS
----------------
Рекомендации по теме
Комментарии
Автор

"Why not use SSH or rsync?" I've already responded to this question a few times in the comments, but I keep seeing people asking the same question. The answer, (as mentioned in the video) is that I didn't have time to set up or configure an SSH server in this scenario. Some people have said "that's not realistic, SSH is usually already installed by default", and it's true that SSH is usually installed by default, but just because SSH is already installed, doesn't mean it's already set up to allow your user account to access it! In fact, the most realistic scenario where this 'netcat file transfer' is realistic is exactly *when* you are setting up your credentials with SSH. In order to install your SSH key onto the remote machine, you need to distribute your public key onto it. This will either mean using a USB flash drive, or sending the public key to an admin who already has shell access. For a computer on your local LAN, it's easier and faster to just use netcat.

Personally, I literally use this exact technique to distribute my public key onto a remote machine on my LAN whenever I'm doing something like setting up Linux on an old laptop or a desktop server. Once the public key is copied, then I can just switch to using SSH. It's easier than bothering to try and find a USB flash drive.

I have also used this technique occasionally when I just want to quickly transfer a large file, like a virtual machine image or something between two computers on the LAN, and I don't have SSH access already set up between these two computers, and I don't want to bother setting it up.

And yes, for the record, this method of transferring the data is *COMPLETELY UNENCRYPTED*. If you need to transfer a file using encryption, use SSH.

RobertElderSoftware
Автор

"But then I remembered the command netcat!" "After 45 minutes of reviewing the netcat --help page and trying to get the command correct it was finally being sent and i was being arrested."

davidsalvador
Автор

1 GB text file? Wow, those have to be some really big secrets!

Carstein
Автор

cli is green -> shit is serious, and then he remembered netcat, brother you have it in you.

timr
Автор

But, gotta ask ... Is it your favourite Linux command?

LeGuJ
Автор

"Then I remember that the routing tables weren't configured correctly and I didn't have access to the routers to add the correct routing tables"

jasonmorris
Автор

If you're in the same situation on a modern Windows: Netcat is often not installed, but Powershell has a nc alias. In case of an old Powershell on a locked down server install, you can use the fact that you can use .NET objects on the Powershell command line to open network connections (or transfer files via http)

der.Schtefan
Автор

“>” is not a pipe. It’s an overwrite redirect. “|” is pipe

maxxroach
Автор

Love your videos! It is amazing how often I just forget about netcat existing. I am so SSH brain'ed at this point. It was great to see this.

askholia
Автор

There are two main Netcat versions: OpenBSD Netcat and GNU Netcat. The -q 0 flag works in OpenBSD Netcat (which tells it to close when the transfer is complete), while in GNU Netcat, the -c flag is used to close the connection when the transfer is complete.

winlogon.
Автор

So glad you finally got it moving. Can't wait to see the remote controller and the machine properly working. Keep up the good work!

riccardobassini
Автор

Highly sensitive files transferred in plaintext.

EmrecanOksum
Автор

just a reminder this traffic will not be encrypted, by default

ryanwalker
Автор

I usually use curl to upload the file to one of my web servers. It's just protected by basic auth, so I can hit it from anywhere with an internet connection, and it's protected by TLS unlike a plain netcat socket.

Автор

The most versatile technique IMO is to use screen's logging feature. For binary files:
cat file | gzip | base64
Directories:
tar cjf - directory | base64
you can extract them from your log later. If the system doesn't have any form of encoder available, you can paste an encoder function.

overclucker
Автор

Add a whitespace right before your nc command so it won't be recorded in the CLI history.

jardel_lucca
Автор

This is so weird.I've seen this months, heck, maybe even years ago, and now I see it again

tecnicoyt
Автор

entertaining and informative!!! thanks

thirtysixnanoseconds
Автор

The hash verification step is so important when using netcat for this purpose

architech
Автор

Yoo u gotta make more like this, better format than the other vids. Entertaining and educational :D

SuperOblivionfan