Skip to content

Instantly share code, notes, and snippets.

@baboures
Forked from thomaspatzke/nmap-open-ports.sh
Last active January 10, 2023 03:06
Show Gist options
  • Save baboures/0ddeb0fcff62a74db79808a94d5ba8d3 to your computer and use it in GitHub Desktop.
Save baboures/0ddeb0fcff62a74db79808a94d5ba8d3 to your computer and use it in GitHub Desktop.
Extract all open ports in Host:Port format from nmap XML output
xmlstarlet sel -t -m '//port/state[@state="open"]/parent::port' -v 'ancestor::host/hostnames/hostname[@type="user"]/@name' -o : -v './@portid' -n nmap-output.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment