Skip to content

Instantly share code, notes, and snippets.

@iTrooz
Created November 13, 2025 20:28
Show Gist options
  • Save iTrooz/2d3749525c16f1d9807d62507b32a0b8 to your computer and use it in GitHub Desktop.
Save iTrooz/2d3749525c16f1d9807d62507b32a0b8 to your computer and use it in GitHub Desktop.
List ports that can be used to
"""
List ports that can be used to connect to this host by dumping incoming connections
After running this command you will need to launch a scan against your host to try to connect to all ports. e.g. with:
nmap -sS -p1-49151 162.38.112.152
Detected new ports will be shown live and deduplicated
"""
tcpdump 'tcp' -l -nn | stdbuf -oL cut -d' ' -f 3 | stdbuf -oL cut -d'.' -f 5 | stdbuf -oL perl -ne '$|=1; print "$_" unless $seen{$_}++' | tee ports.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment