Questions tagged [netcat]

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

0
votes
3answers
279 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 ...
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, ...
3
votes
1answer
670 views

tunnel netcat video streams to mplayer

I am sending a video stream over my network and I want to encrypt it with ssh. This solution below works: on machine 1 I run ./capture | nc 192.168.1.65 5001 on machine 2 I run netcat -l -p 5001 | ...
2
votes
1answer
96 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 ...
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. ...
1
vote
1answer
65 views

What command line tools can be used to manually perform each step of an entire network “conversation”?

I know, I know; the phrase "network conversation" is imprecise almost to the point of meaninglessness. Let's take this specific scenario: I plug in a computer to a DHCP enabled router, open a browser ...
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 ...
0
votes
1answer
33 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
1answer
33 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
911 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
413 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 ...
0
votes
1answer
438 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
1answer
464 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
232 views

Make netcat server timeout over ssh

I am writing a script that ssh's into another machine and opens a netcat server. The server needs to be able to timeout. Using -l ignores -w. The command netcat -w 3 throws the usage back at me. ...
0
votes
1answer
372 views

Convert line of ASCII file to binary packet for NetCat

I have an ASCII file, which looks like this: 36,36,0,1 36,36,0,2 ... What I want to do is to send every row of it as one binary TCP segment's payload with NetCat. To convert the number from file to ...
3
votes
0answers
100 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 ...
3
votes
0answers
591 views

Write to stdin of running process on occasion

From time to time I want to send some text to the input of netcat. Netcat will send it then to another netcat process (either on my machine or a local network), but now I am only concerned with the ...
2
votes
0answers
83 views

How to make netcat print colourful text?

on my Mac I have an peripheral that sends text data to localhost:2332. Some of them are coloured, like this: "\e[1;31mRed text here\e[m normal text here", I use nc loacal host to monitor the data ...
1
vote
0answers
75 views

Line-ending problem with Telnet: can't remove LF from CRLF when sending command

I am unable to get Telnet to send only CR (\r) at the end of a command, despite setting the crlf toggle to <CR><NUL> (see example below). Instead, Telnet always sends CR-LF (\r\n). My ...
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 ...
1
vote
0answers
374 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 ...
1
vote
0answers
31 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 ...
1
vote
0answers
328 views

tcpdump show incoming traffic that is never caught by netcat

We have a vm centos 5.x in a vmware infra that works fine. It has 2 nics and some traffic coming from outside to one of the nic's ip on port UDP 514 and 516. I see with tcpdump the traffic coming ...
1
vote
0answers
408 views

Xinetd: End connection from server script

I have a xinetd service that is a script and the output is read by netcat on a remote host. However, when the script on the server exits, netcat still waits although, there won't follow anything. How ...
1
vote
0answers
295 views

portable way to terminate command (netcat) after timeout

I've got a solution using netcat / nc as a service listening for input, but the service never returns any input to the client. Somewhat like this: server$ nc -l 12345 and then: client$ echo message ...
1
vote
0answers
273 views

Port netcat request info to bash script

I have this super simple TCP server that takes requests and returns the output of handler.sh: #!/bin/bash while true ; do nc -l -p 1234 -e handler.sh; done I'd like to port the requested path to ...
1
vote
0answers
60 views

Ensure that file socket is already opened

I'd like to open a simple file socket that can run in background like: nc -l -k -m 10 -U my_socket -c cat & so other processes can connect into it with nc -U my_socket -c read. After this ...
1
vote
0answers
567 views

How can I temporarily map a remote host and port to a local port?

Say I have a machine A acting as a router with two NICs and the following IP addresses: eth0: 192.168.1.1 (LAN) eth1: 10.0.0.1 (WAN) And I have another machine B on IP address 10.0.0.2 that I want ...
1
vote
0answers
409 views

Netcat server/client for a social thread

I have been learning nc for a while now, and I decided to make a social thread server for it in bash. Surprisingly, I got it working, but I have a couple problems with it. My main problem I want to ...
1
vote
0answers
1k views

Pipe Text Into and Out of Netcat Server Using mkfifo

I wanted to make two pipes for a netcat server that inputs text into the server, and one that outputs text from the server. I have the server running in a seperate script with the input and output ...
1
vote
0answers
568 views

'nc' using ~100% CPU when transferring a FIFO file

On the server which is always connected I’m using this in a crontab: @reboot nc -k -l 1337 < /tmp/fifo.fifo On the client which is not always on the network or switched on I’m using this command: ...
1
vote
0answers
362 views

Pipe a device via USB or wlan

I have an Android phone and I want to use some of its onboard device from PC. To be more clear, there is a node in /dev/ and I want to have on PC a file (or named pipe which is accessable as a file) ...
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
0answers
47 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
17 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 ...
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
0answers
22 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
47 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
0answers
57 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 ...
0
votes
0answers
537 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
0answers
916 views

How to read from the systemd-journald.socket?

To my understanding systemd-journald creates a couple sockets, where it posts its logging events. # systemctl cat systemd-journald.socket | egrep -v '^ *#' [Unit] Description=Journal Socket ...