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
0 votes
2 answers
60 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
18 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
45 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
99 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
113 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
3 votes
1 answer
588 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,637
0 votes
0 answers
25 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
52 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
0 votes
0 answers
78 views

Curl multipart request as raw using netcat

I user Copy as Url and got curl URL -H 'Accept: */*' \ -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \ -H 'Connection: keep-alive' \ -H 'Content-Type: multipart/form-data; boundary=----...
Taimur's user avatar
  • 1
2 votes
1 answer
461 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
252 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
1 vote
1 answer
455 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,235
0 votes
1 answer
197 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
2 votes
1 answer
71 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
45 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
110 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
717 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
23 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
0 votes
1 answer
191 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
47 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
270 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
3k 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
293 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
238 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
871 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
511 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
521 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
930 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
530 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
0 votes
2 answers
3k views

netcat on ubuntu/kali-linux not working

I have a problem with netcat.I tried the "pickle rick" challenge on tryhackme,The problem is that I don't get a shell with netcat: nc -lnvp 9999 and this is the output: Listening on 0.0.0.0 ...
gil.hacker's user avatar
1 vote
1 answer
363 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
2k 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,637
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
773 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
637 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
  • 195
1 vote
1 answer
2k 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
1 vote
1 answer
182 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
  • 223
2 votes
1 answer
963 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
180 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
0 votes
1 answer
907 views

netcat / nc / telnet perform math on received data then output

I am not an expert on bash so sorry in advance. For my high school CTF competition, I have to read in 3 numbers, perform some arithmetic on them, then output the value back to the server. In ...
Peter Stenger's user avatar
0 votes
0 answers
1k views

Netcat listener: Line break between syslog messages

I am playing with netcat command. On this linux system, I have set up a netcat listener on UDP 514, so that I get to see syslog messages from remote systems. $ sudo nc -v -ulp 514 listening on [::]:...
Bruce Malaudzi's user avatar
1 vote
1 answer
194 views

Can I delay exection or otherwise postpone an outgoing netcat connection within a pipe?

I'm not sure if this is an XY problem, but I have to aupport a horrible piece of software that won't talk to modern mail servers properly. It can only do SMTP and insists on providing AUTH ... even ...
Walf's user avatar
  • 1,253
0 votes
1 answer
270 views

how to exit in bash script from ProFTPD via netcat after some copy operations

I am connecting to a proftpd server via netcat nc 10.10.239.150 21 Then I am doing some copy operations like "The mod_copy module implements SITE CPFR and SITE CPTO commands" After "...
florian.isopp's user avatar
0 votes
1 answer
709 views

Netcat working on Linux but not on mac terminal

When I run nc -l 2399 on my mac it doesn't work, regardless of what device I'm trying to connect to on. I run nc 192.168.1.24 2399 and it just prompts me for the next input. When I start the listen ...
Yassine Elshayeb's user avatar
1 vote
1 answer
451 views

Get my public IP from ifconfig.co using netcat

From my Android TV box, I would like to get my public IP and other related info from ifconfig.co, but it does not seem to work. If I try this code, it works fine: adb -s 192.168.1.125:5555 shell ...
user1202609's user avatar
2 votes
0 answers
3k views

How to "cat" a socket?

So to read and write to a socket: Write to a socket: echo "hello" > /dev/tcp/192.168.0.144/27002 Read from socket: netcat -p 27002 -l BUT... I would like to read a socket using "...
jdl's user avatar
  • 855

1
2 3 4 5 6