Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [netcat]

Netcat is a computer networking service for reading from and writing network connections using TCP or UDP

0
votes
1answer
888 views

netcat error: Inappropriate ioctl for device

Im trying to create a 'reverse shell' using a bash oneliner and a netcat listener. This combination worked great a few days ago however now it only gives errors when connection. Does anyone know what ...
0
votes
1answer
44 views

How can I upgrade a primitive Netcat shell to a fully-featured login shell with tab-completion and line editing?

How can I upgrade a primitive Netcat shell to a fully-featured login shell with tab-completion and line editing? Suppose I start a remote (reverse) shell using Netcat as follows: nc -lvp $port nc $...
3
votes
1answer
25 views

Execute a command when upon receipt of a TCP connection

I would like to run a bash command when a remote connection is successfully established to a specified local open port. I have looked into netcat and socat, but I'm not sure if either have the ...
0
votes
1answer
31 views

How can a client talk to another client using unix domain sockets?

Using bash we might have something like this with netcat: nc -lk -U /my/fifo | while read line; do # line => {"client_id":123} done; clients send data like this: echo '{"client_id":123,"data":...
0
votes
0answers
4 views

Send response based on client request using s6-tcpserver4

I am trying to create a socket where the client receives a response based on their request, but I can not figure out how to achieve this on CentOS 7 using s6-networking from http://skarnet.org/...
0
votes
1answer
32 views

Netcat listens on a wrong port

When I run the command nc -l -p 443 it starts listening but when I try connecting to it it fails. A few hours later I tried with verbose mode nc -lvp 443 and it printed out listening on [any] 2443. ...
0
votes
1answer
32 views

Understanding the Netcat properly [closed]

Netcat confuses me a little bit and here are the reasons: when I run: nmap localhost There are some ports listed with the information whether they are open or closed. So if I run the command : nc -l -...
4
votes
2answers
9k views

Stream Video using Netcat and VLC

I'm trying to use netcat on Linux server to stream video to my windows client using VLC I started running netcat on Linux: cat /media/HD1/myMovie.mkv | nc -l 8668 In VLC Windows Client I tried to: ...
1
vote
1answer
8k views

Connecting with sftp using a proxy server

I am trying to connect to an external server using a proxy with the below command: sftp -v -o "ProxyCommand /usr/bin/nc -X connect -x proxyserver.com:8080 %h %p" user@server.com This isn't working. ...
0
votes
0answers
45 views

How to send CTRL+c special char to interactive bash over tcp socket?

I use interactive bash shell over TCP network, but can't figure out how to send CTRL+c sequence to the remote bash. I first run netcat instance (this is where I interact with remote bash): nc -nvlp ...
3
votes
1answer
2k views

Can't redirect cut output

When I try to redirect the output of cut it always seems to be empty. If don't redirect it, the output shows in terminal as expected. This is true for OS X 10.10 and Linux 4.1.6. This works: root@...
0
votes
0answers
15 views

Netcat Computer connections

When I open a command prompt on my host system and enter: nc -lvp 1234 I get the output: listening on [any] 1234 … as expected, and when I open a terminal in one of my virtual machines and ...
2
votes
2answers
239 views

How to use bash to create a socket server and allow multiple clients in the same port?

I have 4 programs, will be increased in the future, these programs have to connect to the same ip:port to send and receive messages at the same time. Until now I have the socket opened, I also would ...
8
votes
4answers
10k views

netcat doesn't terminate when stdin closes

I'm trying to send a message through netcat. After sending the message, netcat must terminate. I've tried the following: cat tsmmessage.bin | nc -u localhost 4300 nc -u localhost 4300 < message....
1
vote
1answer
29 views

compressing a folder tgz , encode to base64 and send over the fly

I am trying to compress a folder, encode to base64 and send it over the fly , but I am getting a error tar: Cowardly refusing to create an empty archive tar -czf Pictures | base64 | nc ...
-2
votes
1answer
81 views

Meaning of ncat connection nc:connect message?

I have a question regarding ncat. I have nc: connect to <IP> port <PORT> (tcp) failed: Connection nc:connect What does this mean?
2
votes
1answer
93 views

How can I write directly to a Solaris FIFO pipe over ssh?

I have a Solaris server running a process that has its input and output redirected into FIFO pipes (fifo_in, fifo_out). How can I connect to these two pipes over ssh? I would like to be able to ...
0
votes
0answers
37 views

Receive only ONE packet using netcat

I would like to use netcat to listen to data and receive only ONE packet. How does one do this?
0
votes
2answers
1k views

Netcat as Daemon

I'm trying to set up something that telnets into a device and saves the output to file. I can get it working on the CLI, but not running it at boot (using crontab) This works running running on the ...
-1
votes
3answers
319 views

How to send literal string over TCP (netcat/socat-like), but provided by command arguments?

If I want to send a string over TCP in a shell environment, I can do something like: echo text | nc 1.2.3.4 9876 Cool. Interactively, that works. Now I want to do this programmatically by spawning a ...
3
votes
2answers
4k views

nc -l in background closes immediately (nc -l 1234 &)

When I put this nc -l 12345 >nc_out in a shell script, run it and then connect from other shell using telnet, it allows me to type some text and have it end up in nc_out. But if I start nc in ...
7
votes
6answers
28k views

netcat: send text to echo service, read reply then exit

I would like to use netcat to send a piece of text to the echo service on my server, get the reply then exit, so that I know the connection is still good. so far I've tried: echo 'test' | netcat ...
13
votes
1answer
21k views

Using netcat for port forwarding

I have a process that listens on an IP:port - in fact it is spark streaming which connects to a socket. The issue is that I wish to somehow create a server that connects to spark on one port and data ...
0
votes
0answers
21 views

writing data out to already opened port

I have a setup in which one unix program (s51 from a microcontroller simulation package) is a server tied to a specific port. Let's call the port 111. I also have setup a client on the same computer ...
0
votes
0answers
45 views

ssh tunnel with intermediary machine using named pipes and without listening on any ports on the intermediary

I would like to use an intermediary host to tunnel between two other hosts which are both behind firewalls, and cannot accept incoming connections. For security reasons, I wish to avoid having any ...
4
votes
1answer
1k views

Remote Mouse netcat (/dev/input/mice)

I was playing around with nc and I'm discovering how powerful and versatile this tool is. I was wondering how the file /dev/input/mice works because when I do cat /dev/input/mice you see the output, ...
0
votes
1answer
84 views

Download zip file from remote HTTPS host using netcat

I'm trying to download a zip file from : https://download.sysinternals.com/files/ProcessExplorer.zip (no curl and no WGET). I want to do that by netcat i used this command : echo -e "GET https://...
-1
votes
2answers
4k views

Using Netcat but client refused. why?

server side: nc -l -p 192.168.1.229 1234 client side: nc 192.168.1.229 1234 but it cannot connect. why?
1
vote
1answer
71 views

Stop netcat as soon as grep matches something

I am facing a problem using netcat in a bash script. I would like to match a specific output after sending a command and continue the script execution as soon as possible (not waiting for a netcat ...
0
votes
1answer
95 views

redirect created files in a directory from command line

I was wondering if there is any way to redirect created files from a .sh script to a specific directory without modifying the script itself but straight from command line. Let's say: I've a script ...
0
votes
1answer
461 views

send input to netcat and save output

I am trying to send a command to netcat which will result into an output and I want to save that output to a file. while true; do echo "showHistory userx"; done | nc -w1 xxx.xxx.xxx.xx 2222 > out....
0
votes
1answer
283 views

Usage of nc with timeouts in ms

I'm using nc in a Debian environment: # dpkg -l | grep netcat ii netcat-traditional 1.10-41+b1 # cat /etc/debian_version 9.4 Its help page describe the behavior of the -w flag: -...
-2
votes
2answers
72 views

How make a port appear open with an nmap scan

To avoid someone knowing which port are open on my machine, I thought it would useful to open all unused port so that the nmaper is unable to identify which port are really open. How make a port ...
0
votes
2answers
96 views

How to let process continue running even after disconnecting ssh?

I have a Linux based router that I’m trying to “control” with a home automation controller. On my automation controller I’m able to utilize a ‘two way strings’ driver to send a string to the Linux ...
1
vote
2answers
371 views

Shell Script in netcat listener to talk with client

I have this script on my netcat server which asks for name and some other information: *echo "Tell me your name" read $ln ...
0
votes
2answers
61 views

Creating persistent netcat link

I have a remote raspberrypi that uses autossh to connect to my local machine (with reverse tunnel -R). This should feed a dump1090 instance on my local machine. I'm using /bin/nc localhost 40005 | /...
0
votes
0answers
55 views

Buffering issue when looking at netcat output

I have problem I am trying to understand: I am sending some UDP data to local host. It is a simple UDP packet with a counter. It counts up to 16 (0xF) and stops. When I grep the received data on the ...
1
vote
1answer
773 views

UDP or TCP hole punching to connect two peers (each one behind a router)

I'm trying to connect directly (without 3rd party server) my computer to a friend's computer. We are both behind a ISP router, and would like (as a challenge!) to connect without modifying the router ...
2
votes
2answers
366 views

Netcat: UDP connections don't terminate?

A simple example, here's my server/host: nc -ul 192.168.0.2 54 And the client: echo "test" | nc -u 192.168.0.2 54 The server will intercept the "test" message, but nc doesn't close. It just ...
14
votes
3answers
3k views

How do I create a UDP packet?

When I perform the following Netcat command and view the packets with Wireshark, it says the UDP packet is malformed. $ echo "this is a test" | nc -u 127.0.0.1 53 Similarly, using commands like $ ...
3
votes
3answers
12k views

getting output from netcat, decoding it and returning an output

I have to get an output from netcat, decode it and return it. after typing: nc cs2107.spro.ink 9000 the output i get is this: Welcome to the Proof of work challenge! Rules: i will provide hex ...
1
vote
1answer
254 views

netcat, inverse name lookup failed, listening on any address

I'm trying to understand why netcat is listening on any address. Here is the command I give and the response I get # nc -l -p 9500 -vvu 172.24.176.221 9500 Warning: Inverse name lookup failed for `...
1
vote
1answer
844 views

How to use Netcat

I have a file on my server that has HL7 messages spread out by a space. Example below. I am wanting to send one of these messages at a time in a continual loop until stopping the script with ctrl+c. I ...
1
vote
1answer
67 views

Are netcat connections stored to any log file in Linux?

I have opened a service: nc -l -p 1234 -e service.sh If someone connects to this service. nc xxx.xxx.xxx.xxx 1234 Can this connection be found in any Linux log file?
0
votes
2answers
415 views

How to “nc -z <address>” with socat?

I want to get the behavior of "nc -z host port ; echo $?" with socat, since my network admins have disabled netcat. The purpose is just to test that a TCP connection is open between two servers. How ...
1
vote
1answer
366 views

Pipe Output of Executable to Existing Netcat Connection

I open a terminal window and connect to shell using netcat: Terminal Window 1: nc hostname port Then, I navigate to a directory and open a file,... etc (I would need to be able to do this myself, ...
1
vote
2answers
3k views

How can I use netcat (nc) for chat client server model?

I am trying to write a daemon using bash. I will enter my partner's IP address and the connection will start using nc partner_ip 2015, likewise on the server I will start the connection using nc -l -p ...
1
vote
2answers
334 views

Print netcat input on terminal

I'm trying to write a script where I cat the content of a file and pipe it into nc: $cat somefile.txt | nc server port The file content is sent to the server as expected but on the terminal I only ...
0
votes
1answer
429 views

ncat v7.6 UDP -k and -w not working as expected

At work ( BSD nc version ) and on many internet examples ncat can listen to udp and be used with the following options : -k which allows multiple connections -w 0 which terminates the current ...
7
votes
1answer
7k views

How to know when NC is done transferring a file

Is there a way to know when netcat is done transferring a file between machines? Current commands: Machine #2: nc -lp 5555 > test.txt Machine #1: nc MachineIP Port < test.txt The transfer ...