Skip to content

Instantly share code, notes, and snippets.

@darth-hp
Last active October 18, 2021 07:01
Show Gist options
  • Select an option

  • Save darth-hp/2013f2b8d0dac619d14a84c94a2b59d3 to your computer and use it in GitHub Desktop.

Select an option

Save darth-hp/2013f2b8d0dac619d14a84c94a2b59d3 to your computer and use it in GitHub Desktop.
poor mans port scanner in bash
PORTS=(80 443);NETWORK="192.168.13"; for i in {1..254}; do IP="$NETWORK.$i"; OPEN=(); for p in ${PORTS[*]};do OPEN+=$(nc -zv4w1 $IP $p >/dev/null 2>&1 && echo " $p"); done; echo "$IP:${OPEN[*]}"; done|grep -E ' [0-9]+'
@darth-hp
Copy link
Author

This snippet scans for http and https ports. Adapt the ports, network (sorry - only C!) and the range to your needs. Only netcat is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment