Live data from Hacker News

Cool stuff you can do with netcat

en.wikipedia.org

1–10 of 44 posts

Re: Cool stuff you can do with netcat

#4

Anyone want to give a few examples of cool things they actually do with netcat?

I use it for:

- creating quick and dirty proxies (nc > fifo > nc). (edit: you can also bridge udp->tcp this way, which makes proxying UDP through an ssh tunnel possible)

- making simple GET requests (printf "GET / HTTP/1.0\r\nHost: www\r\n\r\n" | nc host 80, or save the full request and pipe that to netcat)

- checking if a port is open (nc -p 8080 host, tends to be quicker than nmap and less to type)

- dumb file transfers ('nc -l port > file' on one machine, 'file | nc host2 port') on another (or using tar for directories). Usually I use ssh/scp, but sometimes that nc trick works just fine..

Re: Cool stuff you can do with netcat

#8

Don't forget easy ssh host hopping. ssh -oProxyCommand="ssh host1 nc host2 22" host2

Interesting. Thanks for the tip! I'd never heard of ssh host hopping, but have been doing 2-3 sequential ssh logins for years. I always wondered if this was possible somehow! I found this nice tutorial that explains your tip in detail:

http://sshmenu.sourceforge.net/articles/transparent-mulithop...

This made all the time I've spent on HN in the past week worthwhile! :)

Re: Cool stuff you can do with netcat

#10

I actually got in trouble trying to use netcat for something quite legitimate in my former job at RandomBigCorp... Oops.

Please elaborate?

At my current place of employment, "hacking tools" are banned. On that list is netcat. It is installed on every unix desktop and server, and I use it daily. I have decided to just not point out the stupidity of this -- they might do something that's even more stupid as a response.

Post reply on HN