Don't forget easy ssh host hopping. ssh -oProxyCommand="ssh host1 nc host2 22" host2
To get around that I just added the following to my bashrc
alias remote_host="ssh -t bastion ssh -t host1 ssh host2"
11–20 of 44 posts
Don't forget easy ssh host hopping. ssh -oProxyCommand="ssh host1 nc host2 22" host2
To get around that I just added the following to my bashrc
alias remote_host="ssh -t bastion ssh -t host1 ssh host2"
Anyone want to give a few examples of cool things they actually do with netcat?
computer A:
nc -l $ARBITRARY_PORT | tar vzxf -
computer B: tar vzcf - files_or_directories | nc computer_a $ARBITRARY_PORT
2. Testing socket servers: cat canned_request | nc server 80
There are probably other things, but I don't think, "Oh, this is a good use for netcat", I just do it. It's almost as handy as awk.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 tran…
But yeah, 10100111001
Anyone want to give a few examples of cool things they actually do with netcat?
On the target host, run the following:
nc -l 31337 | bzip2 -d | dd bs=16M of=/dev/sda
On the host you're copying from, do this:
dd bs=16M if=/dev/sda | bzip2 -c |nc dest.host.com 31337
Bear in mind that this isn't secure (everything goes over the wire in clear and there's no auth) and that for best results you should only do this from a live cd (if you're dd'ing from or to the live drive you've mounted there's a high risk that you'll change the filesystem mid-copy, depending on source FS used, this could corrupt the destination).
Anyone want to give a few examples of cool things they actually do with netcat?
host1$ dd if=/dev/zero | nc host2 5432
host2$ nc -l 5432 > /dev/null
Let it run for a moment and then ctrl-C'd host1; the stats dd printed on exit gave a pretty clear answer to my question.Anyone want to give a few examples of cool things they actually do with netcat?
For instance, if server:port 1000 is the normal host and port my application would connect to, I set up a forward from port 2000:
nc -L server:1000 2000
then run my application to connect to localhost:2000 my_application --server=localhost --port=2000
Now my application is connected to localhost:2000, which is forwarded to server:1000 through netcat. To simulate a network connectivity failure I just kill netcat.sender
arecord -f cd -c 2 | lame -b128 - - | netcat -u your-ip 6881 | mpg123 -
receiver arecord -f cd -c 2 | lame -b128 - - | netcat -u -l 6881 | mpg123 -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.
"If you want me to defend you from the bad people on the net, then don't send me to a gun fight with only a knife."
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.
"hacking tools" are banned.
If you are asked about it. The best way is to respond that you use it as a a diagnostic tool or analysis tool.
As for arguing it's not a hacking tool - A person could take something as innocent as VBScript for Office and write viruses with it. Nothing you can do about your tools ability to be abused.
Anyone want to give a few examples of cool things they actually do with netcat?
echo "STATS" | nc localhost 11211
STATS can be replaced w/ other memcached-accepted arguments