Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol.

learn more… | top users | synonyms

15
votes
9answers
11k views

How to set up disk cloning with dd, netcat and ssh tunnel?

I would like to copy stuff in bulk (reimage disk using dd) with netcat from host A to B via ssh encrypted channel on Linux. What commands should I type on both ends? Could you please explain what ...
7
votes
9answers
25k views

Send an email with an attached file using telnet or netcat

I often use telnet or netcat to connect smtp servers to send an email as a test. Does anyone know how you would send an email using telnet or netcat but attach a file as well? There are probably ...
7
votes
3answers
4k views

What's the difference between socat and netcat?

I understand that socat is described as a "more advanced" version of netcat, but what is the actual difference? Would it be correct to say that everything you can do in netcat you can also do in ...
6
votes
3answers
9k views

Connecting to HTTPS with netcat (nc)

I'm working on homework assignment for my college. Task is to fetch web page on HTTPS using nc (netcat). To fetch page on HTTP you I do this: cat request.txt | nc -w 5 <someserver> 80 In ...
6
votes
2answers
11k views

listen to UDP data on local port with netcat

netcat -ul -p2115 fails with a usage statement. What am I doing wrong? Thanks!
5
votes
1answer
9k views

How to get a udp response with netcat

I am trying to do something like: echo "request" | nc -u 1.1.1.1 9999 > response.txt I can see that response is coming from server (with tcpdump) after executing this line. However, my ...
5
votes
5answers
8k views

Netcat (nc) traditional package for RHEL 6.x?

I'm trying to use the Percona Apache Monitoring [Cacti] Template for Memcached. They do indeed warn that you can't use the openbsd version of the package and provide a solution for Ubuntu/Debian ...
4
votes
6answers
2k views

How can I know if netcat & dd are working?

I'm running on server A (Source): dd bs=16M if=/dev/sda|bzip2 -c|nc serverB.example.net 19000 On server B (Destination): nc -l -p 19000|bzip2 -d|dd bs=16M of=/dev/sdb Do I need to see some ...
4
votes
3answers
3k views

Netcat command line issues

I am trying to collect statistics from a memcached server using netcat. ~ $nc 10.251.170.80 11211 stats STAT pid 27508 STAT uptime 7940345 STAT time 1262949310 STAT version 1.2.4 STAT pointer_size ...
3
votes
6answers
810 views

TCP Sessions and IP Changes

What happens to a TCP session when the IP of a client changes? I did a simple test of having netcat listen on a port, and connecting to that port from a client machine. I then changed the IP of ...
3
votes
1answer
2k views

Proxy with netcat forever

I am proxying a VNC TCP server port with netcat. The proxy machine runs linux. This is the comand I use: mkfifo backpipe nc -l 5902 0<backpipe | nc 10.1.1.116 5902 1>backpipe 10.1.1.116 is ...
3
votes
5answers
643 views

Network performance in large transfer of data

I'm using DD over Netcat to copy a hard disk from one system to another, straight clone. I booted RIP on each system. target system: nc -l -p 9000 |pv|dd of=/dev/hda source system: dd if=/dev/hda ...
3
votes
1answer
1k views

What is the purpose of netcat's “-w timeout” option when ssh tunneling?

I am in the exact same situation as the person who posted another question, I am trying to tunnel ssh connections through a gateway server instead of having to ssh into the gateway and manually ssh ...
3
votes
2answers
1k views

netcat -e: the GAPING_SECURITY_HOLE

Why does the BSD version 1.10 of nc disable the -e option found in other, so-called insecure distributions when the same dangerous feature could be trivially achieved as follows even with the 'secure' ...
2
votes
2answers
258 views

How do I log tls-encrypted smtp traffic?

I'd like to know what my local postfix says to the Amazon SES smtpd after the STARTTLS. In plain text, so I can understand it. Amazon SES requires TLS, so I can't temporarily turn it off. I currently ...
2
votes
3answers
502 views

Can Netcat talk to an encrypted port?

I am doing some trouble shooting on an application that listens on tcp 443. This particular application talks via SSL. I wanted to connect to it with netcat. Is this possible? Note: I'm not asking ...
2
votes
5answers
5k views

echo server with netcat or socat

I want a UDP echo server to get packets, and reply exactly what it has received. How can I simply do this using netcat or socat? It should stay alive forever and handle packets coming from several ...
2
votes
2answers
2k views

Getting a TTY in a Connectback Shell

I'm often asked by friends to help with small Linux problems, and more often than not I'm required to login to the remote system. Usually there are a lot of issues with making an account and logging ...
2
votes
1answer
150 views

Apache piping log to netcat fails

I want to send my Apache log in a custom format (GELF) to a UDP receiving server (running Graylog2). I was sure everything was working fine but then after a little while, I got an alert, my server was ...
2
votes
2answers
989 views

Examining Multiple Ports When Running NetCat (nc)

I am looking to test if specific ports are on a host are open. I am using: nc -z host 22 nc -z host 80 nc -z host 443 nc -z host 8080 which works, but it would be nice to use a one-liner like: nc ...
2
votes
2answers
3k views

Netcat UDP File Transfer?

Is there any way to send a file (picture or video) using Netcat and UDP. It defaults as TCP, but I would like to send using UDP. I tried simply adding -u to the nc command, but that didn't work. Here ...
2
votes
1answer
2k views

Netcat - Listen for Multiple UDP Connections

I'm trying to use netcat to debug SIP calls, which communicate over UDP. Is there a way to get the same netcat instance to listen to multiple UDP Connections? I've tried connecting to the same netcat ...
2
votes
2answers
1k views

“netcat -e” / “nc -e” on Mac OS X

netcat [...] -e program nc [...] -e program Is supposed to run program as a server (as far as its stdin and stdout are concerned). netcat on Mac OS X does not seem to have this -e option. Why is ...
2
votes
1answer
206 views

quick check of open port

The following is working as expected. (do not want to use nmap) I need to use nc (or any other built-in centOS) command in shell script to check the port 6379 of a remote server. I want the script to ...
2
votes
2answers
725 views

Netcat, Syslog, UDP, and <134>

Listening with netcat on UDP 514 to syslog data I see that each sent log message is separated by <134>. Does anyone note what <134> is?
2
votes
1answer
598 views

nc (netcat) hangs, waiting for more data, in UDP mode.

I'm trying to send a small string to statsd via nc inside of a read block: while read line; do printf "folder.counter:value|1c" | nc -q 0 -u $host $port done Unfortunately, when in UDP mode, nc ...
2
votes
1answer
576 views

Netcat / nc on ec2… public/private address?

I'm trying to use nc to debug some network issues (but am sort of ending up debugging nc itself). I have the relevant port open (to the world) in the ec2 security group. When I run either of these ...
2
votes
1answer
866 views

Can I use netcat as a lightweight web-server that will save post data as a file?

I know that netcat can be used as a lightweight web-server to host a file, but I want to also have any post data saved to a separate file. Is this possible with netcat? What's the lightest way I can ...
2
votes
1answer
29 views

How to test nagios send_nsca with netcat

I am trying to write a unit test of send_nsca using nc but it is failing. I want to start nc to listen to the nsca port and then use send_ncsa to send a message to that port. In one terminal I am ...
1
vote
1answer
936 views

How can I configure netcat (or some other stock linux utility) to listen on a specific port on a secondary IP address?

CentOS 5.9 For testing purposes, I want my CentOS server to listen on a secondary virtual IP (eth0:0). I'm familiar with nc -l -p <port> but it only listens on the primary. Is there a way I ...
1
vote
1answer
164 views

My sysadmin is on vacation, Help!

I wanted to trouble shoot a certain issue on the server, but I could not connect my debugger since the person who maintains the firewall is off on a vacation. I dont want to mess with his settings. He ...
1
vote
1answer
56 views

Resend the same file simultaneously with netcat in listening mode

I want to set up netcat in listening mode so that many clients can connect and they all receive the same file. The clients should be able to connect simultaneously... Is this possible?
1
vote
2answers
1k views

How can I see sent/received data by netcat?

I follow this post to check speed with netcat , but in his blog when he do ctrl-c ,he get data on sent received bytes. In the post he ran : time yes|nc -v -v -n 192.168.0.8 2222 >/dev/null than ...
1
vote
2answers
556 views

Netcat says 'operation not permitted'

I thought I could easily copy a tgz from a linux box to a windows box (cygwin) by doing this on the linux box: nc -vv -l 4444 < file.tgz And this on the windows box: nc -vv 10.13.13.2 4444 > ...
1
vote
1answer
297 views

How do telnet-based programs report their terminal type to a socket server?

I've written a script called by tcpserver that heavily utilizes tput and similar commands. These commands need to know how to correctly write to the terminal and rely on the TERM variable to obtain ...
1
vote
1answer
427 views

netcat not found in Amazon AMI (Centos)

I followed this guide to migrate my amazon image from one zone to another. Everything goes fine, but when i run this command: netcat -p 9999 -l >/dev/sdf It shows that the command is not found. ...
1
vote
2answers
111 views

Compress streaming data before sending

The following is working as expected. Sending server: mysqldump db_name tbl_name -d | nc -l 1234 Receiving server: nc 10.10.10.114 1234 | mysql -uroot -proot@123 test When I am dumping to ...
1
vote
1answer
801 views

ssh use with netcat to forward connections via bastion host to inside machine

I am having a server in a corporate data centre who's sys admin is me. There are some virtual machines running on it.The main server is accessible from internet via SSH. There are some people who ...
1
vote
1answer
3k views

Is it possible to make a web browser proxy tunnel with Netcat/Socat?

Concerning the Netcat/Socat utility . From the man page, it seems like it is possible to create a secure proxy using netcat by which I could point my web browser to like a proxy server , that could ...
1
vote
2answers
544 views

Using nc.exe (NetCat) to send emails to secured SMTP server (TLS)

I used to send emails to unsecured SMTP servers using nc.exe utility (Windows port of NetCat) and now I need to send the same emails to a secured SMTP server (TLS). What additional parameters do I ...
1
vote
1answer
465 views

Netconsole not working

I've gotten netconsole setup on a server that's been having a variety of kernel panics lately and I'm trying to log kernel messages to another server. I've tested netconsole after setting it up on the ...
1
vote
3answers
302 views

What is Juniper's equivalent to netcat/nc command?

On Linux there is a nice tool for testing connections, bandwidth, opening temp. connections etc: nc What is equivalent on Juniper firewalls?
1
vote
3answers
976 views

Automate hop by hop telnet to Cisco router

I need to automate telnet to a Cisco router and get a "show version" result. The problem is, I need to first to telnet to A, from there telnet to B and then only be able to telnet to the Cisco router. ...
1
vote
1answer
2k views

redirecting output from telnet / nc to file in script fails when cron'd

So, I have device on my network which sits there listening on a port for a connection, and when a connection is made it dumps ascii data out. I need to capture that data to a file. I wrote a dead ...
1
vote
3answers
540 views

Synchronous serving with netcat

This command will persistently serve its output--all hits from today on an apache server--to a browser, via netcat: while true; do grep `date +%d\\/%b` /var/log/apache/access.log | nc -q1 -l -p8080; ...
1
vote
0answers
324 views

How to execute a reverse “Powershell shell” using ncat or netcat?

I am using ncat to execute a reverse "cmd" shell from one machine to another and without any issues using the commands: In my machine: ncat -l 443 In the remote machine: ncat <my ip> ...
1
vote
1answer
303 views

Automatically close netcat connection

I am executing the following command from a script: echo '{"hostUp": true}' | sudo /usr/local/bin/netcat localhost 8001 However, the netcat client stays open indefinitely. How can I close the ...
1
vote
1answer
148 views

netcat doesn't transfer complete file when using UDP

I use the following in order to transfer bigfile (11GB): cat bigfile | pv -L 11m | nc -u 10.0.0.1 3333 After 1.6GB the client stop to transfer (in the target machine i dont see packets ) This is ...
1
vote
2answers
1k views

How do I get netcat to accept connections from outside the LAN?

I'm using netcat as a backend to shovel data back and forth for a program I'm making. I tested my program on the local network, and once it worked I thought it would be a matter of simply forwarding a ...
1
vote
3answers
3k views

Netcat “Connection refused” on localhost

I am trying to get a value from a netcat connection started at a php file, but it dies with: localhost [127.0.0.1] 2000 (?) : Connection refused I don't know why, but it works well if I ssh it as ...