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.

Netcat (or nc, as the executable is traditionally named) is a simple but powerful utility program that reads and writes data across network connections, using TCP or UDP protocol, IPv4 or IPv6, functioning as a client or a server.  It is designed to be a reliable “back-end” tool that can be easily driven by other programs and scripts, but is also well suited to interactive (command-line) usage.  It is so versatile that it is called the “TCP/IP Swiss Army Knife”.

Netcat can be used as a test tool, to exercise network components (e.g., products), but it can also be a building block in a simple prototype system.  It is conceptually a network-enabled version of the Unix cat program, reading data from one place and writing somewhere else.  Like cat, it can handle textual or binary data.  Initially developed for Unix, Netcat is now also available for Windows.  The Unix versions can operate on Unix domain sockets as well as network sockets.  GNU Netcat is distributed freely under the GNU General Public License (GPL).

References: https://en.wikipedia.org/wiki/Netcat, http://nc110.sourceforge.net/index.html, http://netcat.sourceforge.net/index.php (GNU Netcat), and http://www.openbsd.org/cgi-bin/man.cgi?query=nc (a man page).

210 questions
39
votes
9 answers

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 change anything. I am using netcat v1.10 on SuSE…
Chris
  • 521
4
votes
2 answers

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
  • 12,730
2
votes
1 answer

Why is Udcast is many times faster than Netcat?

I use Netcat once in a while to copy files or disk images over the network. While it does the job I always felt like it was always on the slow sluggy side regardless of using ssh, no ssh, compression or no compression. I have started testing out…
kerrreem
  • 405
1
vote
1 answer

Using netcat to connect to znc

I'm trying to send status updates to my IRC channel on irc.foo.com My limitations are.. The msg has to be sent to irc.foo.com from my ZNC account on znc.bar.com (znc is connected to irc.foo.com) The msg contents is sent by POST or GET request to…
Sandalot
  • 31
  • 2
1
vote
1 answer

DDNS and NetCat

I'm messing around with netcat(windows) and i'm trying to configure netcat listening to external connections.My ISP provides me dynamic IP so i gotta find a way to have netcat connecting back to me no matter if my IP changes within 2 or 3 days. What…
1
vote
1 answer

Get Netcat Output, Process and Input All In One Connection

Say I do nc example.com 1234 and it returns two numbers split by a newline, which I must add together and input back in to it. The numbers change if I close the connection, so how would I get the output of netcat, do math on it and input it again…
user873528
1
vote
0 answers

Piping netcat multiple IP's

Is it possible to pipe Netcat with multiple IP's with a file that contains more than 1 IP address? Or the only way is to make a script that parses the file?
1
vote
1 answer

Save HTTP body with netcat

I can save the whole HTTP response from a server using netcat > output.txt, however this saves the HTTP response headers as well, if the body is text this isn't a problem as I can just ignore the headers when I read output.txt. However if it's a…
Jonathan.
  • 2,614
0
votes
1 answer

writing the response of netcat to the text file

I have a script file which sends soap request to the remote server and it gives the response in the terminal . However I want this response from terminal to the text file so I can use it later. I have a netcat request…
laxmi
  • 311
0
votes
0 answers

How to switch between sessions in NetCat

I have a nc in listen mode nc -klvmp 12345 --max-conns 3 I create 3 sessions. At the end I want to be able to switch on the server side between client's sessions. Or work in 1 and then close it and switch to second. How can I do it?
Alex
  • 1
0
votes
1 answer

How to prevent change of bytes when transferring file with nc?

If you open a port on a listening host and send bytes with nc to this port, the hash of the source and destination file might not be the same. Why is that and can it be prevented? Here are the commands i use: On the receiver: bash@ubuntu $ nc -nlvp…
TMOTTM
  • 219
0
votes
1 answer

Linux Remove Previous nc Directive

I need to use nc -lp4 5432 --allow 192.168.1.24 but I have a previous nc directive that only has it listening on localhost. It throws an error when I try overwriting it: $ nc -lp4 5432 --allow 192.168.1.24 Ncat: Got more than one port…
Rich_F
  • 121
0
votes
1 answer

nc Won't Listen on a Port on CentOs6

I'm playing with nc for the file transfer function. On a CentOS6 machine, If I put nc on the listening mode, it returns a help message instead. It seems nc with older visions needs different parameters? [root@test ~]# nc -nlvp 4444 usage: nc…
NeilWang
  • 125
0
votes
3 answers

listening port with netcat not working

I am trying to listen to port 8080 using netcat. It was working fine, suddenly I an getting this. Any idea? root@kali:~# nc -vv -l -p 8080 retrying local 0.0.0.0:8080 : Address already in use retrying local 0.0.0.0:8080 : Address already in…
Rahi
  • 103
0
votes
2 answers

Receiving multiple files at once in Netcat without overwriting last file

1 machine listens(linux), while multiple clients(windows) send files to it on one and the same listening port. Netcat receives the files serially with the -k tag. Listening machine: nc -lp PORT -k > fileX Clients: nc IP PORT < file?? What I…
MyWays
  • 247
1
2