Skip to content

Instantly share code, notes, and snippets.

@joswr1ght
Created July 24, 2022 12:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joswr1ght/fcc955bcf63bf54d7e4324f1cfd82dc4 to your computer and use it in GitHub Desktop.
Save joswr1ght/fcc955bcf63bf54d7e4324f1cfd82dc4 to your computer and use it in GitHub Desktop.
Create a list of top Nmap TCP ports, converted to comma-separated format
grep -v '^#' /usr/local/Cellar/nmap/7.92/share/nmap/nmap-services | grep '/tcp' | sort -r -k3 | awk '{print $2}' | sed 's,/tcp,,' | head -40 | sort -n | gsed -z 's/\n/,/g;s/,$/\n/'
@joswr1ght
Copy link
Author

The gsed part might be fine as sed; I did this on a mac and I wasn't sure if the non-GNU sed that comes with macOS would match on \n.

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