Meredith
Meredith

Reputation: 940

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

Upvotes: 3

Views: 11151

Answers (3)

disrvptor
disrvptor

Reputation: 1612

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

nc -vl <PORT>

Upvotes: 2

Jeff Ferland
Jeff Ferland

Reputation: 18292

 -p source_port
         Specifies the source port nc should use, subject to privilege
         restrictions and availability.  It is an error to use this option
         in conjunction with the -l option.

nc -v -l 12345

Upvotes: 0

ephemient
ephemient

Reputation: 204778

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.

Upvotes: 3

Related Questions