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
0answers
3 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
26 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
30 views

Understanding the Netcat properly [on hold]

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 -...
0
votes
0answers
41 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 ...
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
186 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 ...
1
vote
1answer
26 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 ...
0
votes
0answers
35 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?
-1
votes
3answers
233 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 ...
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
36 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 ...
0
votes
1answer
75 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
vote
1answer
68 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
63 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
213 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
95 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
305 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
53 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
50 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 ...
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 $ ...
1
vote
1answer
208 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 `...
2
votes
2answers
326 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 ...
1
vote
1answer
61 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?
2
votes
1answer
85 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 ...
-2
votes
1answer
69 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?
0
votes
1answer
823 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 ...
1
vote
1answer
315 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
299 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
388 views

Using netcat and curl together in a bash script

This question is more related to infosec, but I can't seem to find a workaround in automating the following process: There is a cURL command which triggers a connection to the netcat. Without ...
1
vote
1answer
68 views

Proc stdin weird behaviour

Can sombody explain why this happening and how to fix it so that the data sent to stdin behaves the same way as the data typed in to stdin. For those who can't see the .gif Basically i have 3 ...
10
votes
2answers
6k views

Netcat - How to listen on a TCP port using IPv6 address?

I am using the newest version of netcat (v1.10-41.1) which does not seem to have an option for IPv6 addresses (as the -6 was in the older versions of nc). If I type in nc -lvnp 2222 and check ...
2
votes
1answer
3k views

create a UDP to serial bridge with socat

I have a piece of software that transmits data over a UDP connection. However in our system we can transmit data only over a serial port. I was thinking of making a bridge between a UDP and serial ...
1
vote
0answers
54 views

Why does ^C on netcat client close the server whereas ^C on server doesn't close the client?

I tested on Ubuntu 18.04 LTS the venerable netcat. The netcat comes from OpenBSD: $ dpkg -l|grep netcat ii netcat-openbsd 1.187-1 amd64 ...
0
votes
1answer
396 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 ...
0
votes
2answers
76 views

xclip doesn’t send contents to netcat

I got an assignment from my teacher to try and beat a bot which sends a number each time and I need to send the exact number, but faster. I wrote a bash script: #!/bin/bash while true; do nc ip ...
0
votes
1answer
54 views

What is making netcat close when I refresh my browser?

If i use netcat to listen to a port like so: nc -l 5555, I can then go to localhost:5555 in my web browser and netcat will print the request. However, if I click refresh in my browser, netcat stops ...
5
votes
1answer
721 views

How to let Netcat execute command after file transfer is complete?

I want to let netcat on my server execute a script that works on a file that has just been sent and have the output of this script be sent as the response to the client. My approach is: On the ...
1
vote
1answer
456 views

connect to server with netcat and receive *multiple* files with one request/connection

Say I have an http or tcp server running, which serves tarballs (.tgz files). Is there some way I can receive files individually so I can do something like this: nc localhost 5000 | how can I read ...
1
vote
0answers
360 views

Send response based on netcat client request

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. Until now I have the socket opened on port 100 ...
3
votes
0answers
96 views

Fast lossless, compressed streaming of packet capture between two servers?

Suppose I am capturing packets on a remote host with tcpdump (more precisely, I'm doing it with an Endace card, which exposes a tcpdump-like utility called dagsnap). What would be a fast way to ...
0
votes
2answers
210 views

Netcat message passing in the same LAN doesn't seem to work

I am trying to send one message from one computer in my home LAN to another in the same LAN using netcat. This is the code I am running in bash: In PC1 nc -l -p 31337 In PC2 (Private IP Address 192....
1
vote
1answer
319 views

Read and write to same netcat tcp connection

I have this pipeline: ( tail -f ${named_pipe} | nc localhost ${port} | ql_conditional_release &> "$HOME/debug.log" & disown; ) &> /dev/null so I am reading from the netcat ...
1
vote
1answer
214 views

Packet delimiter in netcat source file

Is there a delimiter or some way of telling netcat how many bytes to send per packet from a file? Invoking netcat multiple times in a script is not acceptable as I need to send them out as fast as ...
12
votes
1answer
2k views

SSH speed greatly improved via ProxyCommand - but why?

The TL;DR version Watch this ASCII cast or this video - then come up with any reasons why this is happening. The text description that follows provides more context. Details of the setup Machine 1 ...
0
votes
1answer
2k views

nc to retry on connection refuse

is there any solution for nc 192.168.1.1 1234 to retry till it gets connected and once it gets connected ; it will send an output via "nc 192.168.1.1 1234" on machine 192.168.1.1 where it is ...
1
vote
1answer
694 views

Send UDP Packet to Memcached via Netcat

I am attempting to send the stats command to memcached via netcat, however, I am not getting anything back from memcached... I have tried echo "stats" > commands.txt nc -u 127.0.0.1 11211 < ...
1
vote
1answer
313 views

Create lock using unix socket/port

Is there a way to hold a lock a unix port using netcat or some other command? I want to do something like this: set -e; nc -lock 8000 & # this needs to fail if another process holds the lock ...
1
vote
1answer
150 views

watch netcat transfer dump from android to pc

how can i monitor netcat transferring from android to my linux machine i used this command on android device ( sender ) to make a full dump for my device : dd if=/dev/block/mmcblk0 | busybox nc -...
0
votes
3answers
2k views

ncat command gives Idle timeout expired on using option “-i”

I am using the nc command to upload a file to a device, this is how I am using it: nc -i1 "device ip" "port" < /path/to/file this command works fine on Scientific Linux 6.4 32-bit, but after ...