Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listening on multiple ports?

Can't you listen on a port range with netcat? You can scan a range, but not listen it appears. So only solution is scripting?

like image 456
OBV Avatar asked Sep 20 '13 01:09

OBV


1 Answers

I know this post is old, but I recently found a decent solution for this in the form of a nice one-liner. Shell = bash, OS = Redhat 7.

for j in 202{0..5}; do nc -lvnp $j & done

This should open up a number of listening ports from 2020 to 2025, or whatever range you want.

If you are not a root user but a sudoer and have to listen to ports below 1024 add sudo before nc command.

for j in 101{0..5}; do sudo nc -lvnp $j & done

Edited : n/c: The local port parameter was missing. {-p}

like image 110
warybyte Avatar answered Sep 29 '22 20:09

warybyte