Questions tagged [nc]
`nc` is the "network `cat`" program, connecting Unix pipe I/O to TCP and UDP sockets.
87
questions
0
votes
0
answers
34
views
Need to redirect serial port snooping to network UDP socket
Good morning everyone,
I did a little bit of search, but could not really find an answer that would directly apply
I have an embedded device which is sending and receiving data over an RS485 ...
0
votes
1
answer
153
views
Redirect output of current script to a socket
I am trying to debug a shell script executing on a remote server, where I do not have access to the standard output of the script. Can I redirect the output to go over a socket?
0
votes
0
answers
15
views
Why do udp requests fail temporarily
I've a UDP web server, which bound to the port 10000. I just deployed it on the server 172.20.0.10. Then I tried to scan the port nc -v -z -w2 -u 172.20.0.10 10000, it seems that everyting is OK. The ...
0
votes
0
answers
35
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 ...
0
votes
1
answer
20
views
Weird behaviour of bash in Kali Terminal (Qt I think) - piping to nc ends with awaiting input forever
I've been trying to pipe bytecode to netcat (nc) like this:
python3 -c "import sys;bof='a'*16;bof2='a'*8;sys.stdout.buffer.write(bof.encode('ascii')+b'\xef\xbe\xad\xde'+bof2.encode('ascii')+b'\...
0
votes
0
answers
49
views
socat not passing back response from EXEC'd WOL wrapper script to nginx reverse proxy
Background
I've got a jellyfin server. I used to run it on my little atom router/nas box, but the internal graphics card couldn't do transcoding fast enough. So now I've moved it to a box that has a ...
0
votes
0
answers
351
views
UDP to virtual serial port bi-directional bridge
I need to create a bi-directional UDP to virtual serial port bridge,
the serial port will be used in a C program trough an API that can only accept serial ports as its I/O stream.
I tought to use ...
0
votes
0
answers
9
views
Saving POST data received by nc
This works for logging POSTed messages, but it's a bit cumbersome so I was wanting to put it into a script for use with the -e flag.
# while true; do cat 201.txt | nc -l -p 8087 -q 1 | dos2unix >&...
1
vote
0
answers
351
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 ...
0
votes
2
answers
321
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 ...
1
vote
0
answers
763
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 (...
2
votes
0
answers
346
views
Is there any way to send request via authenticated proxy in OpenBSD netcat (nc)?
I am using following command using the nc to connect to my server via proxy (localhost:8080). But this proxy is authenticated. I am not sure how to pass the auth details. Pls. note this is older ...
-1
votes
1
answer
1k
views
How to make nc listen for remote connections
I'm trying to listen for a remote connection but nc keeps giving me this error:
Error: Couldn't setup listening socket (err=-3)
This is the command I used:
nc -lvnp port_number -s my_public_ip
0
votes
0
answers
60
views
Userspace solution to use store data and create a UDP server
I'm trying to come up with a good way manage an intermittently connected device that I'm using for a research project. It's a sensor that goes in and out of the water. While under water, of course, ...
0
votes
1
answer
76
views
Add reponse to the Listening port created with nc -l localhost <some port>
How can I setup a functionality to a listening port created using the nc -l command. I want my server to respond with a pass after connection
0
votes
3
answers
74
views
Conditional `if` with command that doesn't respond in else
I have the following command line, which should return the value 1 in case of, by means of nc, check communication with the IP and Port in question:
/bin/nc -z 10.102.10.22 10003 > /dev/null &&...
0
votes
1
answer
791
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 ...
0
votes
1
answer
108
views
Infinite number of process spawns despite wait and kill (bash)
This code should be a daemon that keeps alive nc command. If nc instance is dead then the daemon should respawn it.
#!/bin/sh
if [ "$1" != "__forked__" ]; then
setsid "$0&...
0
votes
1
answer
264
views
nc: run command upon connection
When doing CTFs, I often run nc -lnvp $PORT and do something else while waiting for a connection. I want to be alerted when said connection is established and I get a shell. Since nc is not terminated ...
0
votes
1
answer
505
views
Changing port when using netcat
The manual instructs to use -p option for entering port. When I tried to use it, 'no port to connect' was displayed. I was connecting to localhost. But the connection went through when nc localhost ...
1
vote
2
answers
1k
views
How do I write a simple request/response tcp server using `nc`?
I’m trying to write a request/response TCP server to handle a small number of very simple commands. I'm using a shell script to be as portable as possible, avoiding compilation or requiring specific ...
0
votes
1
answer
208
views
Can't ncat some ports after opening them in the router and with firewall-cmd
I want to open some ports, both UDP and TCP, on a Fedora 32 server.
First, I've opened them on the router and then restarted the router:
Then, I've opened them in firewalld:
sudo firewall-cmd --...
0
votes
1
answer
229
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 ...
13
votes
1
answer
7k
views
What is `nc -z` used for?
In a solution of an exercise I found this:
nc -z [serverip] [port]
What does it do?
On nc man page I found
-z zero-I/O mode [used for scanning]
not very explanatory... Searching on ...
0
votes
1
answer
4k
views
Ping works, but I get 'No route to host' even though my firewall is off
I want to check if I can connect to Rspamd's Fuzzy port and have a very strange problem - I can ping a the host and get an answer (0% packet loss). But when I try to telnet him, I get "No route to ...
0
votes
1
answer
5k
views
vsftp server returning 500 Illegal PORT command when tried to run raw ftp commands in telnet
Currently, I am trying to run ftp commands from telnet client. I was successful with USER, PASS, PASV, LIST and when tried PORT vsftp server is throwing 500 Illegal PORT command. I am following the ...
1
vote
1
answer
447
views
How to decrypt Cryptcat with key?
I have a Pcapng (Wireshark) encrypted file with Cryptcat and I also have the Password, how can I decrypt the file?
Can't find anything relevant.
Only things like: "Is it Really Secure?
Not if your ...
0
votes
1
answer
404
views
How to use nc to send message consecutively per second
I'm learning the Apache Flink. Here is the Hello World of Flink: https://ci.apache.org/projects/flink/flink-docs-stable/getting-started/tutorials/local_setup.html
This example is a program, which ...
2
votes
3
answers
924
views
How to understand the action of nc -l
I've read the manual of nc, it tells me that nc -l means
Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host. It is an error to use ...
2
votes
1
answer
728
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
1
answer
87
views
What is this code actually doing?
While doing a CTF challenge on a platform, I needed a reverse shell but couldn't get one working so I looked at the processes and found one reverse shell code:
rm /tmp/m;mkfifo /tmp/m;cat /tmp/m|/bin/...
4
votes
3
answers
2k
views
convert one line values to multiple lines with numbering order
The following variable include for example this values
echo $SERVERS
server1,server2,server3,server4,server5
and when I want to pipe them on different lines then I do the following
echo $SERVERS | ...
1
vote
1
answer
992
views
netcat with ssh
every time that I'll send a thing from computer A to computer B with nc, I to use these commands,
Computer A
tar cfp - film.mp4 | nc -w 3 192.168.xxx.xx 1234
Computer B
nc -l -p 1234 | tar xvfp -
...
2
votes
0
answers
781
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. ...
1
vote
2
answers
543
views
How does this nc command work as a HTTP server?
There is an answer that serves a file over HTTP using nc
{ echo -ne "HTTP/1.0 200 OK\r\n\r\n"; cat some.file; } | nc -l -p 8080
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c &...
0
votes
1
answer
225
views
How to configure stderr from nc?
I would like to check port connections with nc and forward the result to a text file.
stdout works fine. stderr is empty, if you don't use -v (which I dont want), so I would like to configure the ...
0
votes
1
answer
480
views
http server with ssl does not work with nc
If run:
cat index.html | nc --ssl --broker --keep-open -l 443
on the client side browser keeps on trying to connect with no success. I mean, the html page does not load.
Besides, curl output is:
...
1
vote
1
answer
460
views
How to send new lines from file to a tcp port?
Wait for file changes and send new lines to a TCP port server.
I've tried
nc 127.0.0.1 1234 -c "tail -F /var/log/changes.log" &
But get broken pipe
0
votes
0
answers
969
views
netcat is timing out before timeout has reached
I am trying to test a port on a remote machine. The connection is over satellite, so latency is quite high. I am testing with NC with the -w option to set the timeout. Ex: nc -w 300 address port ...
0
votes
1
answer
369
views
Redirecting all primary file descriptors using `exec` causes the shell to exit after program exists depending on which end closes the connection?
I've been practicing my Bash skills by creating reverse shells using various redirection operators.
After having set up a nc listener:
nc -lvp 4444
I run the following command:
0<&116-; ...
0
votes
1
answer
612
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
1
answer
700
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 -...
0
votes
1
answer
279
views
How can I list ONLY open ports in a range with nc [duplicate]
I see many examples for nc, even one in the man page, that says
nc -zv 77.77.77.77 10-30
would report the open ports in the range 10-30. However, on my machine all the closed ports are also ...
1
vote
1
answer
2k
views
Sending data to Unix socket failing unless proxied with socat via UDP
I'm trying to debug why data isn't being sent over a Unix Domain Socket.
I have 2 applications which should be communicating over a UDS but aren't.
To test I've done the following:
Using socat, I ...
-1
votes
1
answer
91
views
Does `inetd` (and `nc`) apply only to programs written as daemons?
When inetd makes several programs run as services, does inetd require the programs necessarily written as daemons (e.g. not having a controlling terminal, no interactive input, ...)?
Or caninetd ...
-1
votes
1
answer
172
views
how to capture details from nc
by the following command we can identify which ip are using port 2181 and the relevant port
echo stat | nc localhost 2181
Zookeeper version: 3.4.6-91--1, built on 01/04/2018 10:34 GMT
Clients:
/182....
0
votes
1
answer
395
views
Networking: port listening but nc fails
I have set up a docker-compose stack on a server.
One of its services is jaeger collector and is configured as follows:
collector:
image: jaegertracing/jaeger-collector:1.8
environment:
...
1
vote
2
answers
12k
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 ...
2
votes
2
answers
4k
views
problem piping data into nc
I've written a small UDP server in PHP which listens on a socket, accepts a command, and performs an action. It's really quite basic. I can connect to it manually like this:
% nc -u host port
(...
1
vote
1
answer
3k
views
nc getting stuck unexpectedly
I expected this:
nc -l localhost 7000 </dev/null &
nc localhost 7000 </etc/profile
and this
nc -l localhost 7000 </etc/profile &
nc localhost 7000 </dev/null
to finish after ...