Questions tagged [netcat]

Netcat is a simple but powerful utility program that reads and writes data across network connections, using TCP or UDP protocol, IPv4 or IPv6, with a variety of functions.

Filter by
Sorted by
Tagged with
85 votes
5 answers
97k views

Can the telnet or netcat clients communicate over SSL?

I would like to test client connections with IMAP over SSL, HTTPS, and other secure text-based Internet protocols over SSL/TLS, the same way I would using telnet or netcat if they were not tunneled ...
user553702's user avatar
  • 1,321
54 votes
5 answers
213k views

Netcat on Mac OS X

Is anybody else not able to get nc -lp 8888 working on Mac OS X? Is there another way to get this to work?
kzh's user avatar
  • 4,333
50 votes
6 answers
177k views

Sending file via netcat

I'm using something like this to send file from one computer to another: To serve file (on computer A): cat something.zip | nc -l -p 1234 To receive file (on computer B): netcat server.ip.here. ...
Phil's user avatar
  • 1,451
50 votes
1 answer
36k views

How can I force netcat to send my input immediately, not just on newlines?

How can I force netcat to send my input immediately, not just on newlines? I want to test an HTTP parser manually and check how it behaves when header lines are spread across multiple packets.
thejh's user avatar
  • 1,417
39 votes
9 answers
141k views

How can I pipe commands to a netcat that will stay alive?

echo command | netcat host port This results in the command being sent to the remote host and some data being read back. But after a few seconds, the connection closes. The -w parameter did not ...
Chris's user avatar
  • 521
37 votes
1 answer
41k views

What is the difference between telnet and netcat?

I am looking for an explanation where I can find the difference between telnet and netcat. In which cases should I use telnet and netcat? What a telnet can do that netcat can not do and vice versa? I ...
rbashish's user avatar
  • 496
35 votes
7 answers
45k views

How can I verify that a 1TB file transferred correctly?

I frequently transfer VM images from hypervisors to an archive server for long term storage. I transfer using netcat since it is faster than scp, rsync, ect.. hypervisor$ cat foo.box | nc <...
tbenz9's user avatar
  • 7,095
33 votes
3 answers
57k views

netcat - keep listening for connection in Debian

There's -k option in OS X (BSD) version of netcat to keep listening after current connection is completed. However in Debian (GNU?) version this option is missing. There's -q -1 option to listen ...
Peta Sittek's user avatar
26 votes
3 answers
30k views

How do I interactively type \r\n-terminated query in netcat?

$ nc example.com 80 GET / HTTP/1.1 Host: example.com HTTP/1.1 200 OK ... It works, line separator is just 0A here instead of required 0D0A. How do I type a 0D0A-separated query in netcat? It is ...
Vi.'s user avatar
  • 17.2k
21 votes
1 answer
34k views

Why is "nc -l xxxx" not opening a port?

I'm trying to get netcat to listen on port 4444, but it doesn't seem to be working. I am checking to see if the port is open using nmap, but it doesn't pick it up and I can't figure out why. I have ...
Grezzo's user avatar
  • 962
18 votes
3 answers
42k views

Netcat/socat behavior with piping and UDP?

I guess this is close to linux - Netcat stops listening for UDP traffic - Super User, but I thought I'd better ask anyways As far as versions of netcat I'm using Ubuntu 11.04 and the default netcat ...
sdaau's user avatar
  • 5,538
17 votes
3 answers
90k views

What is the Windows equivalent of the command "nc [server_name] [port]"?

On linux, one can connect to a server by typing nc pwnable.kr 9000 on a terminal. On windows, this does not work in Powershell nor cmd, and also Putty when using Telnet looks at first like it ...
Emolga's user avatar
  • 272
17 votes
2 answers
26k views

Why is the '-e' option missing from netcat-openbsd?

Why is the -e option missing from the netcat-openbsd package? There is a netcat-traditional package but it has many features from the OpenBSD package missing. I am running Linux Mint 16. Does anyone ...
p1xel's user avatar
  • 510
16 votes
3 answers
27k views

netcat as a multithread server

I use netcat to run a simple server like this: while true; do nc -l -p 2468 -e ./my_exe; done This way, anyone is able to connect to my host on port 2468 and talk with "my_exe". Unfortunately, if ...
etuardu's user avatar
  • 827
14 votes
7 answers
65k views

Linux built-in or open source program to join multicast group?

I'm using tcpdump to capture multicast packets and had to code up a custom program to join multicast feeds so tcpdump will "see" the packets. Just wondering if netcat or any other applications can ...
chriskirk's user avatar
  • 343
13 votes
1 answer
29k views

Can I pipe/redirect a console application through netcat so it can be used remotely?

Is it possible to 'pipe' an instance of a console application through netcat, so netcat is listening for a new connection and redirects the stdin and stdout over the network connection.
Jamie's user avatar
  • 241
13 votes
4 answers
39k views

How to send binary data in netcat to an already established connection?

I can do the following to send binary data in netcat: echo -e '\x80' | nc host port But I don't want to do it like this, what I want is to connect to a server: nc 192.168.1.115 12345 And then send ...
user887437's user avatar
13 votes
3 answers
40k views

Sending text file contents to server using netcat?

There is a daemon process listening on port 5144, which I cannot to modify. I want to use netcat to send the contents of a text file to the server, but this causes netcat to hang the terminal until I ...
Amil's user avatar
  • 251
12 votes
1 answer
48k views

Listen to port continuously and dump data to file

I use this command to listen to port and dump data to file: while : ; do nc -l 0.0.0.0 10000 > log.txt & done First request works perfect, it's dumped in log.txt but after first request, the ...
Cristian Boariu's user avatar
9 votes
1 answer
20k views

How to netcat all the files in my directory?

I have a directory of files I'd like to netcat to another machine. For one, I use nc <ip> <port> < sample.fls But if I have a directory of sample1.fls sample2.fls sample3.fls ...
Eric S.'s user avatar
  • 191
9 votes
3 answers
19k views

Use netcat as a proxy to log traffic

I want to use netcat as a proxy to log http requests and responses to files, then tail these to inspect traffic. Think wireshark. Tried the following where 'fifo' is a named pipe, 'in' and 'out' are ...
deephacks's user avatar
  • 191
9 votes
1 answer
6k views

versions of netcat

I've tried the two main versions of netcat : GNU and BSD. (mine is BSD Version). On GNU version, the command $ nc -l -p 12345 works fine but with BSD, option -l (listen) can't be used in conjonction ...
user avatar
8 votes
2 answers
18k views

Netcat stops listening for UDP traffic

I am using netcat on some Linux machines (see this other question), but seeing some unexpected behavior. Unlike the guide in the accepted answer, I am not using UDP tunneling to do DNS queries. I ...
heavyd's user avatar
  • 63.7k
7 votes
2 answers
16k views

Trouble with netcat over UDP

While troubleshooting the problem described here, I tried something really basic: I tried setting up a very basic netcat connection over UDP, and I noticed it's not working as I expect. As with the ...
jia103's user avatar
  • 564
7 votes
1 answer
902 views

Multiple unix pipes not working

This first pipeline works fine (printing "c"): echo "a" | sed 's/a/b/' | sed 's/b/c/' This one does not do what I expect (nothing gets printed when I feed an "a" into my fifo ): mkfifo fifo; cat ...
Sridhar Sarnobat's user avatar
6 votes
1 answer
8k views

How to make `nc` listen on a port without setting `SO_REUSEPORT`

I want to have a nc command listen on a TCP port so I did: nc -lv 8888 Then in another console I checked if another program trying to listen on the same port would get an Address already in use type ...
DWilches's user avatar
  • 295
6 votes
1 answer
1k views

DNS tunneling through an SSH connection looses connectivity

In the Super User question UDP traffic through SSH tunnel, it describes how to tunnel DNS trough a SSH tunnel: First, on the client side, do this: ssh -N -L 6667:localhost:6667 user@server Then, on ...
StackUnderflow's user avatar
6 votes
1 answer
5k views

Differences in nc (netcat) options on Ubuntu vs RedHat

nc -q -1 local host ${PORT} ${CMD} In Ubuntu, nc may be used as above, with the -q option. See manpage. -q after EOF on stdin, wait the specified number of seconds and then quit. If seconds is ...
bguiz's user avatar
  • 2,081
5 votes
2 answers
13k views

How to wait for a response on the inbound side of the socket using NC command under BusyBox?

I am having problems using the Netcat that comes with BusyBox 1.1.3 to make an HTTP request and then receive the response. The NC command seems to quit out as soon as it reaches the end of the request ...
bigjosh's user avatar
  • 605
5 votes
2 answers
5k views

Use rsync with nc as transport layer

By default, rsync uses ssh as a transport layer. Unfortunately with fast local network, ssh is very slow. Is it possible use rsync with netcat / nc ? I have make some experiments, but it does not ...
Znik's user avatar
  • 366
4 votes
2 answers
14k views

How to download a URL from internet by netcat?

I can use netcat to transfer files between two computers. # Server nc -l -p 8080 < file # client nc 192.168.1.101 8080 > file Can I use netcat to download a URL from Internet like wget?
kev's user avatar
  • 12.7k
4 votes
2 answers
11k views

Piping commands into nc

I've seemingly searched many very similar questions but never quite found something to work. I'm trying to use a raspberry pi (2nd gen) to communicate with a Wifi OBDII sensor. I'm able to use the ...
Markysm's user avatar
  • 41
4 votes
1 answer
7k views

Probing a port for RDP

I use an ssh tunnel to RDP into my home computer ("home"). Occasionally, the tunneling software running on home crashes and the RDP port stops getting tunneled. I've attempted to resolve this by ...
Tmdean's user avatar
  • 202
4 votes
1 answer
2k views

Saving Live Video received through Netcat

I'm using the following command to stream a video which I receive through Netcat. nc -l -p 5001 | mplayer -fps 31 -cache 1024 - (On Windows CMD) This command opens the MPlayer and plays the live ...
PasanW's user avatar
  • 162
4 votes
1 answer
2k views

Install both gnu-netcat and openbsd-netcat simultaneously on Arch Linux

They are in conflict when I try to install them conveniently. How can I have both of them at the same time?
radrow's user avatar
  • 143
4 votes
1 answer
3k views

What's the alternative to "nc -l" for HTTPS?

You can run netcat in the "listen" mode: nc -l 8080 This will listen on localhost:8080, dump everything that comes in to stdout and reply with data from netcat's stdin. This is useful for a ...
Nickolay's user avatar
  • 541
4 votes
2 answers
17k views

Netcat: Should I use Ctrl+C to close the connection?

I've opened netcat, and I'm entering things from the keyboard. When I've finished and I want to close the connection, should I just hit "Ctrl+C"? I want the connection to be closed "normally", but I ...
sashoalm's user avatar
  • 4,031
4 votes
5 answers
2k views

Use xargs to send requests to the same server in parallel with netcat

I am trying to devise a one-liner to send text to a simple echo server - but multiple connections in parallel. This is what I'm trying: echo -e A,B,C,D | xargs -d, -i -P 4 echo {} | nc localhost ...
noahz's user avatar
  • 243
4 votes
1 answer
8k views

UDP with netcat on Mac OS

I try to connect to a Tello drone from my Mac by opening an UDP connection to 192.168.10.1 via port 8889 to send commands and receive ack's from the device. When using "Packet Sender" it works, but ...
T. Goschütz's user avatar
4 votes
1 answer
1k views

How to get an ssh socks proxy on demand?

I know ssh provides a SOCKS proxy with -D. I wonder if it's possible to start such a proxy on demand, the moment a connection is made to a specified port (using the likes of socat and nc under the ...
Matei David's user avatar
3 votes
1 answer
11k views

bidirectional socat functionality with nc

This is question is somehow related to https://superuser.com/questions/270698/how-is-it-called-when-listeningconnecting-two-sockets-and-exchanging-data-betw In the test setup I have three terminal ...
Ben's user avatar
  • 31
3 votes
3 answers
4k views

How to set up a secure chat using netcat

I use netcat to chat in LAN. PC1 listen port 8080 $ nc -l -p 8080 PC2 connect to PC1:8080 $ nc 192.168.10.1 8080 Unfortunately, this is not secure. Anyone sniffing packets can intercept my ...
kev's user avatar
  • 12.7k
3 votes
1 answer
15k views

Use netcat to listen on a port and send output from a command when a client connects

I have a Raspberry Pi (Debian Linux) connected to my LAN that can read data from some connected devices and output it to STDOUT. Let's say the program is run on "Server" and I want to serve the ...
Joshua Besneatte's user avatar
3 votes
2 answers
3k views

Why can't nc / netcat sniff http port traffic easily?

I'm NOT looking for advice such as "try wireshark." I'm trying to understand what netcat is and isn't. When I try to listen (-l) to port 80, it says "address already in use." Can netcat not listen to ...
Sridhar Sarnobat's user avatar
3 votes
4 answers
11k views

How to get the WAN IP from a router using UPnP/SSDP

I'm trying to find a way to get my router to report back my WAN IP using UPnP/SSDP, but so far I have been unable to even get a list of UPnP supporting internet access devices on my network. Here's ...
phor2's user avatar
  • 133
3 votes
1 answer
2k views

X11Forwarding using SSH and Netcat

From my machine, I must connect through nodes A, B, and C, to reach target: localhost -> A -> B -> C -> target Machine A is configured to refuse X11 Forwarding, so I guess I shouldn't ...
Rubens's user avatar
  • 660
3 votes
0 answers
2k views

Why does this netcat pipeline work in macOS but not Linux?

I set up the following pipeline. This allows me to see the raw HTTP requests and responses that pass through the pipeline. Note: I use BSD nc below (this is what comes with macOS and AmazonLinux), ...
Josh Cooley's user avatar
2 votes
2 answers
4k views

Is NetCat command dangerous?

I'm s server-side developer and used to invoke the nc command to check whether a remote port is open. Suddenly, the security guy prohibited the command and as soon as I use the nc command my ...
Jin Kwon's user avatar
  • 336
2 votes
3 answers
4k views

How to make netcat support ssl by combining openssl?

Original netcat doesn't support ssl. ncat from nmap project does. In linux, we can connect multiple commands with pipeline. Is it possible to combine netcat and openssl to create a ncat?
kev's user avatar
  • 12.7k
2 votes
2 answers
7k views

List incoming connections on nc (netcat)

I set up nc on some computers in my office. They're connecting to our server like so: nc 192.168.1.2 3291 -e cmd Does anyone know how to list incoming connection attempts rather than accept one? ...
Megsi's user avatar
  • 23

1
2 3 4 5