Stack Exchange Network

Stack Exchange network consists of 174 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

1
vote
0answers
18 views

Save Data From NCAT and update Database

I have a raspberry pi Device in two of my shops which will send data using ncat to my Linux machine at my home via the internet. I need to continuously listen to the TCP port 7070 and update my SQL ...
0
votes
1answer
38 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
62 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
65 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
38 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
26 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
17 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
2k 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
57 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
63 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
32 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
43 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
1answer
308 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
47 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
99 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
252 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
50 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 ...
8
votes
2answers
3k 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
1k 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
46 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
180 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
60 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
44 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
319 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
278 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 ...
0
votes
0answers
281 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
68 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
102 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
267 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
140 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
1k 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 ...
0
votes
0answers
399 views

Multiple UDP connections in Netcat : no messages received

I am trying to send UDP data from one linux host to another using the netcat utility. The terminal output on the server side $ nc -uvkl 1234 Listening on [0.0.0.0] (family 0, port 1234) ...
0
votes
1answer
545 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
253 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
87 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
1k 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 ...
1
vote
2answers
103 views

How can i execute text as code from server to client on shell script (netcat)

I have two files, client.sh and server.sh, all the necessary data is on the server, which is sent to the client using netcat, the client just get these data and display it to the end user, the problem ...
2
votes
1answer
399 views

socat forward input to both tcp-connect and exec (script)

I'm interested in implementing the advanced content filter example for postfix. socat tcp-listen:10026,reuseaddr,fork tcp:localhost:10025 This is a simple "passthru" that works, but obviously doesn'...
3
votes
1answer
2k views

How can i keep netcat connection open?

I have two files, client.sh and server.sh, all the necessary data is on the server, which is sent to the client using netcat, the client just get these data and display it to the end user, the problem ...
0
votes
0answers
333 views

UDP hole punching with a third party

I am now convinced that direct "UDP hole punching" between 2 people each of them behind a NAT, without 3rd party server is really difficult / sometimes impossible (see question here and my answer ...
0
votes
1answer
333 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....
1
vote
1answer
502 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 ...
1
vote
0answers
29 views

Netcat interaction issue

I am following a tutorial where two ports (45678 & 45679) are specified in an Ubuntu Docker container. The container to used to listen to input on 45678 and route them to 45679. Then the video ...
2
votes
1answer
1k views

UDP port unreachable although process is listening

I am experimenting with communication over UDP port 6666 (the goal is setting up a listener for netconsole, but that's not really relevant here). On the listening side, nc -luv 6666. On the sending ...
0
votes
3answers
191 views

How can I send bytes to a friend's distant computer without 3rd party server?

Let's say my IP is 198.51.100.27 and my friend's IP is 203.0.113.11. We both are connected to internet behind a standard consumer ISP router. How can we send a few bytes to each other without using a ...
0
votes
2answers
718 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 ...
0
votes
2answers
290 views

How can I reliably send data from a TCP port on one computer across the network to a different port on another?

I have two applications on two networked Linux machines on the same LAN. One runs a server program which listens for TCP connections on a specified port and when connected, emits (but does not receive)...
0
votes
2answers
2k views

How to pipe a loop to one netcat connection

I'm doing a challenge where I have to feed a password (which I have) and a 4 digit passcode (which can only be found via brute-forcing all 10000 possibilities) to a netcat daemon. Currently I'm doing ...
4
votes
1answer
107 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, ...