Listening on multiple ports?

OBV picture OBV · Sep 20, 2013 · Viewed 17.8k times · Source

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?

Answer

warybyte picture warybyte · Apr 20, 2018

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.

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