Skip to main content

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
3 votes
1 answer
386 views

Piping live sound from raspberry pi to macOS

I want to pipe and live play the sound recorded on my raspberry to my MacBook. I've tried the following: On My raspberry: I tried to establish a data stream on a port 3333 arecord -D plughw:3,0 -f ...
zahntheo's user avatar
0 votes
1 answer
74 views

websocat command argument equivalent for this nginx custom configuration?

I have this nginx custom configuration: server { listen 8080; server_name subdomain.domain.my.id; location /vless-ws { # Consistent with the path of V2Ray configuration if ($...
isysrg's user avatar
  • 3
0 votes
0 answers
33 views

Passing video from v4l2loopback to v4l2src (edgetpuvision) using netcat

I am trying to use webcam from a tablet as stream source for TensorFlow Model on Coral Dev Board. My idea is to pass the stream from the tablet using netcat: ffmpeg -i /dev/video0 -filter:v fps=30 -f ...
Radek Suski's user avatar
0 votes
0 answers
36 views

Reading from FIFO in nc (netcat)

I have a bunch of log files that I'd like to watch as they get updated. I came up with the script below: #!/bin/bash # Check if at least one log file is provided if [ "$#" -eq 0 ]; then ...
farhanhubble's user avatar
-1 votes
1 answer
58 views

How I could check connectivity in shell using an oneliner command without using netcat?

In a docker image I want to avoid installing netcat in order to ping for db connectivity at my entrypoint script: /bin/sh MOODLE_DB_HOST="xxxx" MOODLE_DB_PORT=80 function pingdb { OK=0 ...
Dimitrios Desyllas's user avatar
0 votes
0 answers
55 views

using netcat stty not giving complete tty shell when doing CLTR+Z

I'm using netcat and stty to get terminal (tty) access, but I'm not able to do so as the CLTR+Z action on the netcat session is giving me suspended session instead of stopped and then I'm not able to ...
asadz's user avatar
  • 233
0 votes
0 answers
36 views

Strange incongruent output for both nc and fifo

I have this exact code: #!/bin/bash gtimeout(){ if type -f gtimeout &> /dev/null; then command gtimeout "$@" else timeout "$@" fi } export -f gtimeout; ...
Alexander Mills's user avatar
0 votes
1 answer
207 views

busybox nc server cannot accept new connection once the old one dropped out

BusyBox v1.36.1 (2023-07-17 18:29:09 UTC) multi-call binary. I run minimal nc server like: nc -lkp 12345 I can connect to it once nc localhost 12345. After ctr-C, the next attempt will fail. however ...
Wang's user avatar
  • 1,336
1 vote
1 answer
127 views

Can nc send message from client to server on a udp port?

Both client and server are Debian 11 On Server as root: nc -ulp 1194 On Client as root: nc -u serverip 1194 When I type something on client, in theory it should appear on the server right if no ...
rocky_alpine's user avatar
0 votes
2 answers
238 views

How to pass a bash variable (list of numeric data) to gnuplot *without using a file*

I am using netcat to get a series of points which I would like to plot with gnuplot. However, I am having trouble passing the data to gnuplot without writing it to a file first. In the simplest case, ...
Sebastian's user avatar
0 votes
0 answers
60 views

netcat redirects stderr to stdout then variable losing newlines [duplicate]

I am working on a script to parse a file containing a list of IP addresses and ports then do a bunch of test on the ports with netcat. The port argument can be a single port, a list of ports, or a ...
math's user avatar
  • 119
0 votes
0 answers
116 views

MD5 Hash modified trought netcat

I used dd to create a sample empty file with 1MB, edited the sample file, created a MD5 hash of the file, started a listener on the examiner machine, piped the output off to nc and compared the hashes....
kappa's user avatar
  • 1
0 votes
1 answer
324 views

Can I relay the data received from Netcat to a URL as a POST?

I have a PHP-based website, and I'm trying to integrate it with another system. This system sends XML data to a specific port (let's say port 9999). I am able to capture the incoming data and save it ...
brayne's user avatar
  • 1
1 vote
1 answer
538 views

send (alsa) audio via network via UDP

This to my understanding records mono in wav format for 300 seconds to a named pipe called "mic_rec" rec arecord -D hw:4,0 -d 300 -f cd -t wav -c 1 mic_rec And this sends whatever it finds ...
Daniel's user avatar
  • 153
6 votes
1 answer
3k views

Discrepancies in netcat installation process between debian bullseye vs debian bookworm-slim

In debian:bullseye oot@4770c7ba00ac:/# apt install -y netcat Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be ...
pkaramol's user avatar
  • 2,879
0 votes
0 answers
32 views

Netcat uploads hanging after a certain point

I'm working through an introductory cybersec challenge that requires me to upload a word and brute force a 4 digit code to a port. I put the combinations in a file, and tried to use netcat to upload ...
Noah Massey's user avatar
1 vote
1 answer
183 views

How to pipe terminal interaction with running process over network?

How can I run a program that expects to be executing in a terminal in such a way that it's STDIO can be arbitrarily connected-to remotely? Specifically, I want to be able to launch gdb on one host and ...
Billy's user avatar
  • 111
2 votes
1 answer
1k views

Can i trust echo result of nc command for UDP?

Context : I want to test UDP port with nc command What happens : nc command return nothing on output and 0 when i put echo $? Which command : nc -vzu <ip> <port> echo $? What is the ...
adhara's user avatar
  • 23
2 votes
1 answer
649 views

ipv6 multicast fails when it should loop back to self

So far I use multicast with ipv4 and it works; all involved computers run linux. I listen on two machines and send on one of those two (in a separate terminal). In the below example 'Hello 1' is ...
Al_'s user avatar
  • 23
2 votes
1 answer
1k views

Usage of named pipe as data source for netcat

I want to use netcat as a TCP-server that reads data from a named pipe. For that I did the following: Step 1. Created a pipe and the server that uses it as a source mkfifo /tmp/all.pipe nc -k -l 8080 &...
ka3ak's user avatar
  • 1,265
0 votes
1 answer
420 views

netcat forwarding and listening

I am listening on a port for logs coming from a device, then I used netcat to redirect those logs to a text file whenever a log is available on the device and all this to happen in the background ...
joseph's user avatar
  • 1
3 votes
1 answer
140 views

Unable to get output from netconsole

nc -l -u 6666 on the receiving machine gets no messages from netconsole. tested by doing "echo test > /dev/kmsg" i am able to connect with netcat by doing "nc -u 10.0.0.192 6666"...
Gooberpatrol66's user avatar
0 votes
0 answers
78 views

finger daemon / nc fowarding error

For an assignment I'm trying to properly send a buffer overflow exploit with ncat in order gain root access on a vulnerable machine set up by the professor. I feel I created my egg right but I keep ...
Jacob ricondo's user avatar
0 votes
0 answers
210 views

How can I write a command into a subprocess?

Currently, I am working on a project where I use telnet to netcat to send an email message within my university. I am trying to make the process automated but my script can't seem to enter in any ...
Mitchell Zhou's user avatar
0 votes
1 answer
1k views

Socat specify source port

How do I specify source port in socat? In netcat I can simply: nc -u -s 192.168.0.1 -p 8888 192.168.0.2 9999 I tried socat udp4:192.168.0.2:9999 STDIN:192.168.0.1:8888 It's failed STDIN: wrong ...
Muhammad Ikhwan Perwira's user avatar
0 votes
0 answers
45 views

why does Netcat show output in the wrong order?

I am using netcat to run a file over a network like so nc -lvnp 1111 -e file on the client machine, the connection is empty and I only get an output after I enter an input. How to show the output of ...
sam's user avatar
  • 1
1 vote
1 answer
348 views

How do I inject a header line into a pipe via a shell script?

I am working on a process to send data via a pipe from one server to another for processing. Although this is not the exact command, it might look something like this: tail -f logfile | grep "abc&...
Ben Holness's user avatar
0 votes
0 answers
1k views

How to port forward my ubuntu 22.04 using iptables

Do you know how to gives iptables rules to my machine in order to allow trafic from my public interfaces(wlp3s0) to my private interfaces(lo). Kinda with this topology: 192.168.1.1:80 => 127.0.0.1:...
Turing's user avatar
  • 1
0 votes
1 answer
67 views

Bash script to open a port when traffice is being recieved

I have 2 Ubuntu boxes one of them acting as an Attack platform (we will call it AP), the other as an already compromised server (we will call it S1). I have this rule sudo iptables -t nat -I ...
noah allen's user avatar
1 vote
1 answer
464 views

Is it possible to create a ncat loop?

If you had two computers, wanting to control one from another using only ncat, without using telnet, ssh or other networking tools and only two shells, how could i go about that? I have successfully ...
Tada Fireworks's user avatar
0 votes
1 answer
6k views

"Connection refused" when I try to send a UDP packet with netcat on an embedded-linux board

I'm trying to send a binary packet to a local process, via netcat (nc), like this: nc -w 1 -u localhost 10000 < my_binary_packet.bin The output is: read(net): Connection refused Anyone know what'...
Gabriel Staples's user avatar
1 vote
0 answers
3k views

netcat command not working

Any idea why nc command is not working and telnet is working. Ideally nc will also work. I am trying to use nc in script but getting error however telnet is working. Ideally nc command is working for ...
rizwan's user avatar
  • 11
1 vote
0 answers
405 views

How to pass IP address to netcat as variable in bash scripting?

I have this script on a Linux machine that loops through a .txt file to see if connection is successful or not. When I give the IP directly is works. However, when I pass the variable it says: nc: ...
Shwan's user avatar
  • 11
0 votes
0 answers
251 views

Exporting Python's script errors/traceback to file with netcat

I have a Python script accessible with netcat: nc 'serverIP' port. The Python script awaits an input from the user. If the input is expected, the script keeps running. If the input is unexpect (e.g. ...
McBonobo's user avatar
2 votes
1 answer
2k views

How can I connect to a specfic Ethernet interface using netcat

I am trying to use netcat to echo some data to a custom board I have. The board is connected using a 10G Ethernet connection. I can see that the link is up but when I try using netcat I am not getting ...
jon's user avatar
  • 21
1 vote
0 answers
637 views

Basic webserver supporting post+get (using curl and netcat)

Sorry if the question's title isn't clear about the objective of this question. I was able to make a respond-only webserver using Bash only; when it gets a curl post request, it returns results no ...
Daniella Mesquita's user avatar
0 votes
2 answers
892 views

netcat in systemd service resets

I am using netcat to connect to a server over TCP and continuously pipe the data received to file. nc 10.0.2.2 3456 > file.data When running this from terminal or a script it stays connected I want ...
abnsosl's user avatar
1 vote
0 answers
1k views

nc -lvnp (port) Non-responsive w/ PHP Reverse Shell til closed

I am currently working on Machine's on HackTheBox. I've used nc -lvnp (port) quite a bit and i've never ran into this issue: $nc -lvnp 4444 listening on [any] 4444 .... connect to [my IP] from (...
Adam Carson's user avatar
0 votes
1 answer
2k views

SOCAT (only) reverse tunnel

I have a situation where we are trying to get data from one network to another - specifically access to a private maven repo on a different network. Network 1 contains a maven repo. And network is ...
Jeef's user avatar
  • 157
3 votes
0 answers
785 views

'netcat' not working as expected on Arch, but works on openSUSE Tumbleweed? What's going on?

I'm having a bit of trouble utilising netcat on Arch, specifically, the GNU version of it. My situation: I basically made a simple server in Python that can accept multiple clients and send responses. ...
cpolish's user avatar
  • 31
1 vote
1 answer
512 views

How to "talk" to a "parent" IP in a subnet?

I have access to just *nix systems. Either NetBSD and/or bare Linux-based OS. So my question comes from the fact that ADB is not widely available on all platforms, if so is very hard to install or ...
abacox's user avatar
  • 143
4 votes
1 answer
4k views

netcat closing connection on localhost listening end after connection attempt

Ι am nc-listening on localhost:2500 ▶ nc -l 2500 _ On another terminal I am trying to connect to this listening end ▶ nc -zv localhost 2500 nc: connectx to localhost port 2500 (tcp) failed: ...
pkaramol's user avatar
  • 2,879
0 votes
1 answer
2k views

netcat broadcast understanding

I'm using macOS with gnu netcat. I want to understand how can I broadcast message using netcat. I have a netcat listening on 4555 netcat -l -p 4555 192.168.0.101 but as I attempt to send a broadcast ...
Noobie's user avatar
  • 105
0 votes
1 answer
1k views

Using netcat to setup a bind shell on localhost, but having issue with '-e' flag

I'm trying to do a simple exercise, where I need to set up a "server" hosting a bind shell, using netcat. On my localhost. I'm running ubuntu 20.04 I'm following this tutorial, that has this ...
NotQuiteSo1337's user avatar
1 vote
2 answers
2k views

'ncat' considers redirection as (additional) port specification when run from python script

In a python script I am trying to run a subrocess that listens and recives a file using ncat: proc = subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) ...
doronbs11's user avatar
3 votes
1 answer
834 views

Playing, recording, and streaming sound with cat and /dev/dsp

A couple of comments on Hacker News suggest that, on FreeBSD, you can: use cat to send a file ( a .wav file for instance ) to the audio speaker (/dev/dsp). record from the mic using a similar method. ...
beekay's user avatar
  • 205
1 vote
1 answer
3k views

Netcat with device or interface flag?

Traceroute has an -i flag, -i interface, --interface=interface Specifies the interface through which traceroute should send packets. By default, the interface is selected according to the routing ...
Evan Carroll's user avatar
  • 31.8k
1 vote
1 answer
204 views

How to get grep to exit immediately when command is received from netcat?

I want to open a port and listen for a command, and when that command comes in, immediately run a script. The best I've come up with is (the echo is a substitute for my script): nc -lk 9999 | grep -q ...
localhost's user avatar
  • 243
2 votes
1 answer
1k views

netcat producing EINVAL when sending to UDP IPv6 multicast

I'm using netcat on Fedora to test an IPv6 UDP multi-cast address. The command is echo hi | nc -6 -u ff02::777:777:777 7777 netcat responds, "Invalid argument." Running strace yields ...
Daniel Walker's user avatar
0 votes
0 answers
224 views

Prevent ncat from terminating after running python script

How do I prevent ncat from terminating after running a python script? My current netcat command is: ncat -lvp 50000 -e main.py. I would also like it so there can only be one connection per ip.
user471579's user avatar

1
2 3 4 5 6