look out honey 'cause I'm using technology

Transfer files via netcat and tar

netcat - smNetcat (nc) is a “…simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol. It is designed to be a reliable back-end” tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.” Basically it’s another small, cool Unix tool that allows you to do tons of cool stuff. I found this example out there that lets you transfer files via tar from one box to another. As with anything to do with nc, it’s dead simple, and logical. On the target box, start nc to listen on a port, and tar up anything it ‘hears’ like this:

nc -l -p $PORT | tar -xf -

Then, on the source system, have tar pipe out to netcat, that is pointed to the target host/ip:

tar -cf - $DIRECTORY | nc $HOST $PORT

Damn, how cool. There’s plenty more info out there, and the more you look the more you’ll realize what you can do with nc. Tons of great info at the above Wikipedia link, and I also found a great overview at Vulwatch.org. Have fun!



Related posts

    
  • wch
    In the version of nc installed on my machine, the -p flag doesn't work, and shouldn't be there. It should just be "nc -l $PORT".
  • Jan
    I'm trying to do you example vi at (later with cron). But after the initial contact from the sending host, netcat on the receiving side exits!
    when I do the same on the command line it works.
blog comments powered by Disqus

We like








We support


EFF - Electronic Frontier Foundation       TOR - The Onion Router       HRC - Human Rights Campaign