Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netcat reverse shell

I am trying to create a reverse shell for two computers on my network, I used netcat a few years ago, I remember I did something like to listen for incoming connections:

netcat -v -l -p <PORT>

But now when I try that it doesn't work, I just get the netcat usage:

$ netcat -v -l -p 12345
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
      [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
      [-x proxy_address[:port]] [hostname] [port[s]]

Did something changed in the latest netcat releases?

I am using ubuntu 10.04

like image 226
Meredith Avatar asked Mar 15 '26 10:03

Meredith


2 Answers

There's a bajillion different netcat variants out there. (Okay, not really; maybe half a dozen major ones.) Each has different features.

In Ubuntu, you can install netcat-openbsd, netcat-traditional, netcat6. netcat is simply a symlink managed by update-alternatives [--display/--set] nc.

netcat-openbsd is most likely to be installed and set as default by Ubuntu 10.04 (and is directly depended upon by libvirt-bin), but your option set only works on the other implementations. You can use nc.traditional or nc6 (after installing the proper packages, of course), or use update-alternatives to set them as the default netcat.

like image 176
ephemient Avatar answered Mar 17 '26 02:03

ephemient


If you drop the -p you should be listening on port <PORT>.

nc -vl <PORT>
like image 23
disrvptor Avatar answered Mar 17 '26 01:03

disrvptor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!