Questions tagged [netcat]

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

features:

  • Outbound and inbound connections, TCP or UDP, to or from any ports.
  • Featured tunneling mode which allows also special tunneling such as UDP to TCP, with the possibility of specifying all network parameters (source port/interface, listening port/interface, and the remote host allowed to connect to the tunnel.
  • Built-in port-scanning capabilities, with randomizer.
  • Advanced usage options, such as buffered send-mode (one line every N seconds), and hexdump (to stderr or to a specified file) of trasmitted and received data.
  • Optional RFC854 telnet codes parser and responder.
180 questions
72
votes
3 answers

Listen to UDP data on local port with netcat

netcat -ul -p2115 fails with a usage statement. What am I doing wrong?
Tyler
  • 823
  • 1
  • 6
  • 5
56
votes
4 answers

Connecting to HTTPS with netcat (nc)

I'm working on a homework assignment for my college course. The task is to fetch web pages on HTTPS using nc (netcat). To fetch a page over HTTP, I can simply do the following: cat request.txt | nc -w 5 80 In request.txt I have an HTTP…
Oto Brglez
  • 762
  • 1
  • 5
  • 9
54
votes
3 answers

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 socat? What about the opposite (everything you can do…
bantic
  • 1,469
  • 3
  • 14
  • 17
45
votes
6 answers

How to automatically close netcat connection after data is sent?

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 connection once this data has been sent?
Justin Meltzer
  • 621
  • 1
  • 9
  • 18
29
votes
6 answers

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 hosts.
Mohammad Hedayati
  • 629
  • 1
  • 6
  • 12
28
votes
9 answers

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?
Evgeny
  • 599
  • 3
  • 10
  • 17
25
votes
2 answers

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 but it only listens on the primary. Is there a way I can specify a specific IP for the listener to use? If…
Mike B
  • 11,570
  • 42
  • 106
  • 165
22
votes
2 answers

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 restart graylog2 then the messages about it starting…
cr0c
  • 1,116
  • 3
  • 15
  • 32
17
votes
3 answers

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 precluded from installing anything on the…
λ Jonas Gorauskas
  • 373
  • 1
  • 4
  • 9
17
votes
5 answers

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 seems to want to wait indefinitely, even though…
bshacklett
  • 1,378
  • 4
  • 19
  • 37
17
votes
1 answer

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 0backpipe 10.1.1.116 is the "remote" machine with the original VNC service running…
Alojz Janez
  • 473
  • 2
  • 5
  • 16
16
votes
9 answers

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 better ways, but I still want to know :-) I would…
Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
13
votes
5 answers

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 too. This bug seem to have been reported already:…
Ilya I
  • 288
  • 1
  • 2
  • 7
12
votes
5 answers

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 users, i.e.: You need nc on the server. Some versions…
HTTP500
  • 4,827
  • 4
  • 22
  • 31
12
votes
1 answer

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.txt stays empty. Is there a way to get it?
user39593
1
2 3
11 12