Questions tagged [nc]

`nc` is the "network `cat`" program, connecting Unix pipe I/O to TCP and UDP sockets.

Filter by
Sorted by
Tagged with
6
votes
1answer
586 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
1answer
34 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
1answer
110 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
1answer
42 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
1answer
16 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
3answers
138 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 ...
1
vote
1answer
20 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
1answer
40 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/...
2
votes
3answers
273 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 | ...
0
votes
1answer
103 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 - ...
0
votes
0answers
24 views

Why can't the UDP coming from nc command without -v be captured by tcpdump

Saying that I have two machines in my LAN, A and B. I execute tcpdump -i eth0 port 1234 at A to capture the packet coming from the port 1234. Then I execute nc -u -v -z -w2 IP_OF_A 1234 at B to scan ...
3
votes
0answers
62 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
2answers
115 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
1answer
62 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
1answer
92 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
1answer
34 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
0answers
94 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
0answers
297 views

Socat is echoing back the user input

I am remotely connecting to a serial COM port via socket created by socat. The idea is to manage multiple devices mapped as PORT:SERIAL_TTY. Everything works fine except it echoes back my commands ...
0
votes
1answer
124 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
1answer
217 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
169 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
1answer
28 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
1answer
641 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 ...
-2
votes
1answer
55 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
1answer
77 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
1answer
208 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
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 ...
2
votes
2answers
2k 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 (...
0
votes
1answer
824 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 ...
1
vote
2answers
676 views

Print netcat input on terminal

I'm trying to write a script where I cat the content of a file and pipe it into nc: $cat somefile.txt | nc server port The file content is sent to the server as expected but on the terminal I only ...
3
votes
1answer
3k views

How to create a public unix domain socket?

Consider /var/run/acpid.socket. At any point I can connect to it and disconnect from it. Compare that with nc: $ nc -l -U ./myunixsocket.sock Ncat: bind to ./myunixsocket.sock: Address already in use....
0
votes
1answer
962 views

ncat v7.6 UDP -k and -w not working as expected

At work ( BSD nc version ) and on many internet examples ncat can listen to udp and be used with the following options : -k which allows multiple connections -w 0 which terminates the current ...
0
votes
1answer
63 views

How can I run this tcp command in Ubuntu? [closed]

I want to run this command in Ubuntu: tcp 0 0 0.0.0.0:50010 0.0.0.0:* LISTEN <pid>/java but tcp is not recognized in Ubuntu. What could be an alternative for this?
-4
votes
6answers
14k views

Brute-force 4 digit pin with pass using shell script

I am doing some challenges. This is one them. I am trying to brute-force 4 digit pin with the password to get my desired answer. After connecting to the port It prompts me to enter the password then ...
3
votes
3answers
62 views

'Reversed shell' - pull shell commands from remote host with human-controlled input?

I would like to connect to a remote machine, ideally over SSH, and then pull the commands from there. To be precise, I would like make a remote machine connect to my local machine, where I would have ...
0
votes
1answer
4k 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 ...
0
votes
3answers
4k 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 ...
0
votes
2answers
2k 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 ...
1
vote
1answer
935 views

How to decrypt Cryptcat (twofish) data?

I have some packets that are encrypted with Cryptcat tool and I want to decrypt them. I have the encryption password. I tried to use netcat with cryptcat, but every time I'm connecting from netcat to ...
4
votes
1answer
2k views

How does this command work? mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc -l 1234 > /tmp/f

Today I was reading the nc man page and stumbled on this command. I know that: mkfifo /tmp/f is creating a named pipe at /tmp/f. cat /tmp/f is printing whatever is written to that named pipe and the ...
1
vote
1answer
1k views

How to stream video with netcat

I'd like to have Raspberry Pi stream video, so I'm doing this: raspivid ... -o - | nc -l -k 4242 But the problem is that the pipe or nc, is caching the data until someone connects. But I don't want ...
1
vote
0answers
364 views

How to `nc -l 1234 | bash` but send response back to connecter

I have a basic netcat listener on my network that uses this command: nc -l 1234 | bash. This command runs everything it receives in nc into BASh. It works, however, only the listener can see the ...
1
vote
1answer
183 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 ...
22
votes
2answers
30k 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 ...
2
votes
1answer
14k 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. ...
0
votes
1answer
116 views

Retrieve file from list as nc input

I'm trying to create a simple script (one liner, actually) that takes the content of the a file, makes it random, and provides the output to netcat as the connection destination. This is what I ...
4
votes
2answers
4k views

Is nc (netcat) on MacOS missing the “-e” flag?

When I try to run nc -l 1337 -e /bin/bash, it says: nc: invalid option -- e usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port] [--apple-delegate-pid pid] [--...
3
votes
1answer
884 views

'netcat -e' not relaying stdout

I'm using netcat to create a backdoor running a python script with the following command: netcat -l -p 1234 -e 'python /script.py' then I'm connecting to the backdoor with another shell using: ...
3
votes
1answer
86 views

Remote control alarm

I want one of machine have a remote control alarm running that can be triggered by any remote machine. More precisely Machine A is running the service in the background Any remote machine B can send ...
1
vote
1answer
2k views

Port forwarding isn't working on mac osx

I've setup port-forwarding on my mac like this: sudo sysctl net.inet.ip.forwarding=1 echo "rdr pass inet proto tcp from any to any port 445 -> 127.0.0.1 port 5441" | sudo pfctl -ef - To this ...