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

learn more… | top users | synonyms

20
votes
9answers
17k 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?
17
votes
2answers
40k views

listen to UDP data on local port with netcat

netcat -ul -p2115 fails with a usage statement. What am I doing wrong? Thanks!
14
votes
3answers
9k 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 ...
13
votes
4answers
24k views

Connecting to HTTPS with netcat (nc) [closed]

I'm working on homework assignment for my college. Task is to fetch web page on HTTPS using nc (netcat). To fetch a page over HTTP, I do this: cat request.txt | nc -w 5 <someserver> 80 In ...
12
votes
8answers
43k 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 ...
12
votes
1answer
9k 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 ...
10
votes
5answers
20k 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 ...
9
votes
3answers
3k 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 ...
8
votes
3answers
4k 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 ...
8
votes
1answer
14k 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 response....
7
votes
5answers
3k views

Netcat fails to start in listening mode

I'm using CentOS 6.7 (Final) system, and when I try to run nc in listening mode it prints the following: # nc -l 1234 nc: Protocol not available The port is not bound. I tried other port numbers ...
7
votes
1answer
8k views

Send echo message to graylog2 via GELF TCP 12201 port

I need to send a message to graylog2 server via echo to test if the %{@type} for facility is corrent, but once I do the echo thats in GELF support does not arrive in to my graylog2 server. If it ...
5
votes
6answers
3k 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 ...
5
votes
5answers
15k 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 ...
5
votes
3answers
1k views

Sending a file from Docker container to host using nc: Why does host nc close the connection too early?

The following BASH script downloads and builds mpv (https://github.com/mpv-player/mpv-build) in a Docker container, and sends the file to the host using netcat (the host is listening using netcat): ...
4
votes
2answers
9k 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 ...
4
votes
3answers
7k 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 ...
4
votes
1answer
3k 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 ...
4
votes
3answers
6k 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 ...
4
votes
2answers
6k 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 ...
3
votes
6answers
2k 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
2answers
96 views

Check if remote host/port is open - Can't use GNU Netcat nor NMap - RHEL 7

At work, the infrastructure team is rolling out new VMs with RHEL7 installed as the base OS. This particular image comes with the nmap-ncat version of Netcat and does not have NMap installed. We are ...
3
votes
2answers
4k 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 ...
3
votes
1answer
765 views

Difference between /dev/udp and netcat

I have a syslog server listening on localhost:514 as UDP and would like to write messages to it on that port. (Using Ubuntu 14.04) If I run either of these commands this from bash it prints the date ...
3
votes
1answer
2k 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 ...
3
votes
1answer
4k 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 ...
3
votes
1answer
2k views

Netcat not able to bind a listening socket

In my computer with Ubuntu 14.04 I can do things like this: $ nc -l 5349 -vvv Listening on [0.0.0.0] (family 0, port 5349) or this: $ nc -vvv -l 192.168.254.96 5349 Listening on [192.168.254.96] (...
3
votes
5answers
876 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
2answers
2k 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' ...
3
votes
1answer
140 views

How to redirect a udp response with netcat

Similar question to How to get a udp response with netcat except the OP was satisfied with using nc interactively (and I don't have the reputation to comment yet!) I need to be able to code some bash ...
3
votes
1answer
934 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 ...
2
votes
2answers
645 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
1answer
4k views

How to send 0x80 byte to a tcp port using netcat or similar tool?

I'm trying to make a Memcached server respond as if I where using binary protocol. If possible just command line answers pls, no code spinet in any programming language.
2
votes
2answers
4k 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 ...
2
votes
3answers
3k 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
2k 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
365 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
1k 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 ...
2
votes
1answer
1k 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 ...
2
votes
2answers
1k 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
2k 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
2answers
52 views

Check if iptables rules are working

I have three virtualboxs. 1) Virtual machine VM-A that works as a router with two interfaces: eth0 - 10.160.10.254 eth1 - 172.10.0.254 2) Virtual machine VM-B that works as an internal network ...
2
votes
1answer
112 views

Clarification of netcat result

I've been trying to debug an issue on our servers and Im confused by this response from netcat. Can anyone explain why Im getting these 2 contradictory messages when checking to see if a port is ...
2
votes
1answer
523 views

netcat closes established connection between docker containers

I am on coreos and have started three containers. docker run --rm -ti -p 80 --name one ubuntu /bin/bash docker run --rm --link one:one -p $HOST_IP::80 -ti --name two ubuntu /bin/bash docker run --rm -...
2
votes
1answer
3k views

How do I test HTTP Pipelinning?

I am trying to test if site/server/whatever has ability to pipeline HTTP request. So far, I think it is possible to send several request through one curl session, like: curl http://www.example.com/...
2
votes
1answer
1k 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
0answers
36 views

IP Forwarding Configurations [closed]

I am testing ip forwarding to recieve external connections from my computer at home. I did the following from my router settings: Turned off firewall of router and fedora, done forwarding settings, ...
2
votes
0answers
239 views

Postfix mailbox_command + netcat + nodejs

I use Node.js script to process incoming emails and pipe them from Postfix via netcat in mailbox_command (namely: nc 127.0.0.1 3002). Node is listening on port 3002 and calls socket.destroy() once ...
1
vote
2answers
3k views

Send Text String to a Socket In Windows

I have a server that has an open socket that listens for a particular text string on it in order to perform an action. Our linux machines send this data via: echo "text_string" | nc -w 2 server-...
1
vote
1answer
171 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 ...