Questions tagged [netcat]
Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol.
188
questions
76
votes
3
answers
255k
views
Listen to UDP data on local port with netcat
netcat -ul -p2115 fails with a usage statement.
What am I doing wrong?
59
votes
4
answers
142k
views
Connecting to HTTPS with netcat (nc) [closed]
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 ...
59
votes
3
answers
37k
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 ...
56
votes
6
answers
117k
views
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 ...
35
votes
6
answers
76k
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 ...
28
votes
9
answers
33k
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?
27
votes
3
answers
96k
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 ...
24
votes
2
answers
43k
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 ...
18
votes
5
answers
28k
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 ...
17
votes
3
answers
28k
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 ...
17
votes
1
answer
28k
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 ...
16
votes
9
answers
85k
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 ...
13
votes
3
answers
68k
views
Contacting DNS server via command line interface [closed]
So, we are on the DNS chapter in our class, and I was wondering if there's any way possible though which I can connect to a DNS server on port 53 via command line interface (i.e Telnet or netcat) like ...
13
votes
5
answers
16k
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 too.
...
13
votes
1
answer
31k
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....
12
votes
5
answers
26k
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 ...
11
votes
3
answers
27k
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 ...
11
votes
1
answer
35k
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 were using a binary protocol. If possible just command line answers pls, no code snippet in any programming language.
11
votes
5
answers
28k
views
make netcat listen for multiple UDP packets
If I run a simple UDP listener like this:
nc -l -u -p 1234
Then I appear to only get the first inbound UDP packet. For example if I run:
$ echo abc | nc -u localhost 1234
["abc" appears in output ...
10
votes
1
answer
35k
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] (...
9
votes
6
answers
26k
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 -...
7
votes
3
answers
23k
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 ...
7
votes
2
answers
38k
views
Netcat issue, getaddrinfo: Name or service not known
I am trying to use netcat to relay SSH traffic (bidirectionally) from port 2222 on one host to port 22 on a different host. For test purposes, I redirect to 127.0.0.1:22 here instead of the remote ...
7
votes
3
answers
4k
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):
...
6
votes
7
answers
5k
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 ...
6
votes
2
answers
24k
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 ...
6
votes
1
answer
7k
views
How can I set the source port for an SSH command-line client? [closed]
I am creating a web challenge, and due to a firewall, I need to be able to bind an SSH client source socket to a fixed port to pass its traffic through the firewall.
Is there any way to do this using ...
6
votes
1
answer
8k
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 ...
6
votes
3
answers
6k
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' ...
6
votes
4
answers
18k
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 ...
5
votes
6
answers
5k
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 ...
5
votes
3
answers
10k
views
Why do netcat scans for UDP ports always succeed?
I'm trying to verify that a couple of our servers can communicate via certain ports before migrating some of our services to them, and that they're not blocked by our organizations firewall ACLs.
...
5
votes
2
answers
10k
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 ...
5
votes
1
answer
4k
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 from bash it prints the date ...
5
votes
1
answer
3k
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 ...
5
votes
3
answers
53k
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 ...
4
votes
1
answer
1k
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 ...
4
votes
1
answer
7k
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
2
answers
3k
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 ...
3
votes
2
answers
2k
views
Routing TCP packets to a local UDP port
A third party server sends UDP packets to an EC2 instance we've set up and I'm trying to route those packets to my local machine.
The client sends these packets to port 8975
To that effect I first ...
3
votes
2
answers
3k
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 ...
3
votes
1
answer
7k
views
How can I capture the exit status of `nc` when run from `timeout`?
I want to test connectivity to an arbitrary host using netcat. It seems the -w argument does not actually close the connection after 5 seconds. (This is on Ubuntu 14.04 and netcat-traditional 1.10-40)....
3
votes
5
answers
2k
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
1
answer
5k
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/...
3
votes
2
answers
10k
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 ...
3
votes
1
answer
4k
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 ...
3
votes
1
answer
20k
views
Using netcat in windows to forward a tcp door to another machine
I have a computer with windows 7 under a firewall which can only initiate connections to other computers. It has a proxy server on it (port 9000) and I want to forward it to another machine (192.168.1....
3
votes
1
answer
4k
views
Is there a built-in way to proxy SSH through socks5?
I have a Socks5 proxy that uses username/password authentication. I can use it with SSH using NCAT in the ProxyCommand: ssh -o ProxyCommand="ncat --proxy-type socks5 --proxy-auth username:...
3
votes
0
answers
2k
views
How can I test network connectivity to a Keberos KDC (UDP/88)
How can I test network connectivity to a Keberos KDC (UDP/88)? Does Kerberos have a standard way to communicate that gives any output?
HTTP for example,
nc -v google.com 80
GET
will dump the ...
3
votes
1
answer
1k
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 ...