Skip to content

Instantly share code, notes, and snippets.

@3isenHeiM
Created December 9, 2020 13:29
Show Gist options
  • Save 3isenHeiM/f6865424187c0d7fba0bc2e57db84fef to your computer and use it in GitHub Desktop.
Save 3isenHeiM/f6865424187c0d7fba0bc2e57db84fef to your computer and use it in GitHub Desktop.
Build Nmap top port list
#/bin/bash
# This snippet will output a comma-separated list of the top XXX most used ports (according to Nmap),
# given XXX a number (eg 20, 1000) passed as argument.
# Usage (to output the top 10 most common ports) :
# root@localhost # ./Nmap_top_port_list.sh 10
# 21-23,25,80,110,139,443,445,3389
top=$1
nmap --top-ports $top localhost -v -oG - | grep TCP | cut -d ";" -f 2 | cut -d ")" -f 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment