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.
186 questions
5
votes
3 answers

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. Makes Sense [mrduki@mybox1~]$ nc -ul…
MrDuk
  • 865
  • 2
  • 10
  • 18
5
votes
3 answers

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 apache user (www-data). This is what I've…
coma
  • 185
  • 1
  • 1
  • 8
5
votes
6 answers

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 the client while that nc session was open and sent…
Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448
5
votes
1 answer

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 every 2 seconds to syslog # Using netcat while true;…
user779159
  • 395
  • 1
  • 5
  • 10
5
votes
1 answer

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 not responding. I see in the Apache error log a…
ETL
  • 6,513
  • 1
  • 28
  • 48
5
votes
2 answers

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 in (sometimes the box is behind a NAT device,…
Asad R.
  • 208
  • 3
  • 9
4
votes
1 answer

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 working? Is it failing to connect via TCP and then…
Doug McK
  • 153
  • 4
4
votes
1 answer

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 again to the destination server from there. I am…
jrdioko
  • 567
  • 5
  • 9
  • 18
3
votes
2 answers

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 established an ssh tunnel to my ec2 instance ssh -4…
Jayaram
  • 153
  • 1
  • 1
  • 7
3
votes
0 answers

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 website nc -v smtp.gmail.com 587 ehlo…
Jacob Evans
  • 7,886
  • 3
  • 29
  • 57
3
votes
1 answer

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). It will only continue to try connecting for 5…
Server Fault
  • 3,714
  • 12
  • 54
  • 89
3
votes
1 answer

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 script and deal with the response. How should the…
user1011471
  • 179
  • 1
  • 8
3
votes
1 answer

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 running: nc -l 5667 -v In the other: echo -e…
DavidGamba
  • 306
  • 2
  • 8
3
votes
5 answers

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 |pv|nc 9000 -q 10 The transfer seems to be hovering…
Bart Silverstrim
  • 31,172
  • 9
  • 67
  • 87
3
votes
2 answers

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 log both legs of the traffic with this…
Johannes Ernst
  • 1,097
  • 5
  • 17
  • 27
1 2
3
12 13