Questions tagged [netcat]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
416 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
108 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
286 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
362 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
247 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
3k 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
751 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
377 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
216 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
3k 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
203 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
638 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
6k 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
622 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
501 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
950 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
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 ...
2
votes
1answer
3k 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
321 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
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 ...
0
votes
2answers
440 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
4k 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 ...
3
votes
1answer
175 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, ...
1
vote
1answer
85 views

Security of netcat

I'm receiving complaints quite often that users can't hard-reset their VMs on my virtualization host. So I decided to set up some way of killing VM, without giving full access to QEMU console to users....
0
votes
1answer
2k views

Are the GNU Netcat commands the same as netcat-openbsd or netcat-traditional?

I can't find the list of commands for GNU Netcat. But they say on their official website the following: Goals of this project are full compatibility with the original nc 1.10 that is widely used,...
5
votes
3answers
5k views

How to know which flavor of netcat I'm using?

There are two flavors of netcat: netcat-openbsd and netcat-traditional. How to know which flavor of netcat I'm using? I've tried man nc but it doesn't say what flavor it is.
4
votes
1answer
868 views

Bash - Use automatic file descriptor creation instead of fifo

At the beginning, I created a small server with netcat and it worked well: #!/bin/bash PORT="1234"; startServer(){ fifo="fifo/$1"; mkfifo "$fifo"; connected="0"; netcat -q 0 -l -p ...
1
vote
1answer
1k views

Testing iptables DNAT Rule Locally Using NetCat

My general question is this: What's the best way (simplest, easiest, quickest, least error-prone, etc.) to verify iptables NAT rules locally on a single host (i.e. without a network connection) at the ...
1
vote
0answers
1k 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 ...
3
votes
1answer
538 views

Can I resume a failed (ZoL) ZFS send over netcat?

I have a volume with client data that is encrypted using ZFS native encryption. I was trying to send this from a Ubuntu server to a Debian server. It is not possible to receive zfs send data into ...
2
votes
1answer
1k views

Netcat Bad Request [closed]

I'm using Ubuntu and I switched to netcat-traditional version but when I try to make simple HTTP requests it always failing, any cases, any servers giving 400 Bad request: (Apache Ubuntu is running ...
2
votes
1answer
223 views

Separate dd data from output through netcat to parse output

I'm copying dd output through netcat with the following command $dd if=/dev/zero bs=1024K count=1 | nc <IP_ADDR> <PORT> -q 0 1+0 enregistrements lus 1+0 enregistrements écrits 1048576 ...
1
vote
1answer
13k views

How to manually update Nmap's Ncat on Centos 7

How do I manually upgrade the nmap-ncat package on Centos 7?
2
votes
1answer
720 views

Using up arrow to get previous command in netcat

I'm working a lot with netcat recently to test a server, and having use of the up arrow to repeat previous commands would be extremely helpful. Right now however, it only enters ^[[A. Is there any way ...
0
votes
1answer
2k views

Check if remote port is reachable using Centos [duplicate]

On Dubian, I can do the following using netcat (aka nc, ncat): michael@pi1:~ $ nc -zv 10.120.11.1 20 21 22 23 24 nc: connect to 10.120.11.1 port 20 (tcp) failed: Connection refused Connection to 10....
1
vote
1answer
128 views

How can I overwrite the destination file netcat writes to as opposed to appending?

I have two ubuntu servers and will be using a script (although I have not written it yet) on the sending server to send file abcd.txt whenever it changes using: nc 10.10.10.4 3333 < abcd.txt On ...
1
vote
1answer
460 views

How to scan outbound closed ports with nmap?

I just noticed that my server is being blocked for rsync from a firewall outside of my server, so I can't rsync to any target. Now, I would also like to know what are all the ports that are being ...
1
vote
0answers
350 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
443 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
2answers
1k views

How send a command to background using ssh on remote system

I'm trying to open a port on remote system using ssh & netcat like this: ssh user@host.tld 'netcat -l 7777 &' but it waits to show output and doesn't go to background! I tried nohup before ...
4
votes
3answers
11k views

Why netcat doesn't use the right interface associated with the IP?

I have two network interfaces, A 1.2.3.4 and B 1.2.3.99. (in ifconfig) I run nc -l 1.2.3.99 20101 -v to listen on the interface B. I run nc -v 1.2.3.99 20101 -s 1.2.3.4 -4 because I want to use the ...
18
votes
2answers
24k views

What are the differences between ncat, nc and netcat?

I'm not sure about when to use nc, netcat or ncat. If one is the deprecated version of another? If one is only available on one distribution? If it is the same command but with different names? In ...
1
vote
0answers
308 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 ...
2
votes
1answer
9k 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
2answers
5k 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
702 views

Chat with friend using netcat

I have tried using nc to chat and transfer files over my local network. However, I am having trouble doing it over internet (with my friend). While doing it locally, i would be using ifconfig to view ...
1
vote
1answer
310 views

How to pipe netcat's output? Problems with xargs and quotes

I'm trying to pipe whatever nc receives with this: nc -l 20000 | xargs /root/test ...and it works fine, except when xargs receives quoted arguments - it splits them as if they were separate... ...
2
votes
1answer
1k views

socat pipe to pipe for multiple open-write-close and open-read-close operations

I'm trying to use socat on two systems in order to send a multivolume tar from one system to the other. Multivolume is an absolute requirement as I'm trying to shift potentially petabytes of data to a ...
0
votes
1answer
91 views

netcat pipe running too early?

I have the following script running in the background: while true; do { file=$(/somescript); echo -ne "HTTP/1.0 200 OK\r\n\r\n"; cat $file; } | nc -l -p 20000 done It works fine, except that /...